This repository contains sample container configurations of Oracle Management Agent to facilitate installation and environment setup for DevOps users. This project includes Dockerfiles based on Oracle Linux and Oracle OpenJDK 8.
The certification of Oracle Management Agent in a container does not require the use of any file presented in this repository. Customers and users are welcome to use them as starters, and customize/tweak, or create from scratch new scripts and Dockerfiles.
Note: The Oracle Management Agent container image no longer requires elevated privileges. You can now chose to create a new user for the agent when building the image or at runtime by providing the UID and GID values of an existing user account on the host system.
Oracle Management Agent image uses the official oraclelinux:8-slim
container image as the base image.
Download the Oracle Management Agent software
Note: Select 'Downloads and Keys' then download 'Agent for LINUX (X86_64)' of the package type ZIP.
Copy the downloaded bundle to the same directory as the Dockerfile
cp oracle.mgmt_agent.zip OracleManagementAgent/dockerfiles/latest/
Change to the directory in which the Dockerfile
for this container image is located
cd OracleManagementAgent/dockerfiles/latest/
Follow the steps in the Create Install Key documentation to download the install key.
Next, follow the steps to Configure a Response File and save it locally as input.rsp
in the current directory.
Create a directory on the host to store persisitent data. This directory will be bind mounted into the container at runtime.
rm -rf /oracle-management-agent
mkdir -p /oracle-management-agent
Create a local user account that will be used to run the container. This can be any user account on the host system and if the desired user already exists then this step can be skipped.
groupadd -g 9100 orclmgmtagntgrp
useradd orclmgmtagntusr -u 9200 -g 9100 -m -s /bin/bash
Note: Remember to substitute
orclmgmtagntusr
andorclmgmtagntgrp
, wherever applicable, with the desired user if you choose to skip this step.
Change ownership of the directory holding persistent data to the desired user.
chown -R orclmgmtagntusr:orclmgmtagntgrp /oracle-management-agent
Ensure your tenancy is configured correctly by applying the documented prerequisites for deploying management agents
Create .env file to populate the environment variables
echo "mgmtagent_hostname=mgmtagentcontainer1" > .env
echo "DOCKER_BASE_DIR=/oracle-management-agent" >> .env
echo "USERID=$(id -u orclmgmtagntusr)" >> .env
echo "GROUPID=$(id -g orclmgmtagntusr)" >> .env
Use Docker Compose CLI to build and run a container image
docker-compose up --build -d
Build the container image
> docker build -t oracle/mgmtagent-container .
Copy the Install Key (input.rsp
) into the directory that will be bind mounted into the container and used for persistent storage
mkdir -p /oracle-management-agent/mgmtagent_secret/
cp input.rsp /oracle-management-agent/mgmtagent_secret/
chown -R orclmgmtagntusr:orclmgmtagntgrp /oracle-management-agent/mgmtagent_secret/
Start a container
# commands given below expect user to be running in a bash shell
export USERID=$(id -u orclmgmtagntusr)
export GROUPID=$(id -g orclmgmtagntusr)
docker run --user $USERID:$GROUPID -d --name mgmtagentcontainer1 --hostname mgmtagentcontainer1 -v /oracle-management-agent/:/opt/oracle:rw --restart unless-stopped oracle/mgmtagent-container:latest
Note: Refer to description of the recommended run parameters used above
Remove the Install Key (input.rsp
) from the host directory after verifying the new Oracle Management Agent is registered and visible in the main Oracle Management Agent page
> rm /oracle-management-agent/mgmtagent_secret/input.rsp
You can provide a custom shell script that will run before the Oracle Management Agent starts by following these steps
Refer to init-agent.sh in the user-scripts directory
Modify the script init-agent.sh
to add custom commands that execute each time before Oracle Management Agent starts
Follow the steps to build and run a container and validate the output of init-agent.sh
script is visible in the logs by running the following command
> docker logs mgmtagent-container
Below are some possible solutions to common issues that may occur when running the Oracle Management Agent in a container
mkdir: cannot create directory '/opt/oracle/bootstrap': Permission denied
Invalid argument: /opt/oracle/mgmtagent_secret/input.rsp
Oracle Management Agent registration failures due to old state files from a prior install
rm -rf /oracle-management-agent/
Starting a stopped Oracle Management Agent Container
docker start mgmtagent-container
Stopping a running Oracle Management Agent Container
docker stop mgmtagent-container
Inspecting the logs of a running Oracle Management Agent container
docker logs mgmtagent-container
Gathering UID and GID of a user from the host environment
id -u <username> # prints UID of user
id -g <username> # prints GID of user
Creating a nominated user account during image development (optional)
groupadd -g <numeric-gid-value> <desired-groupname>
# example:
groupadd -g 9100 orclmgmtagntgrp
useradd <desired-username> -u <numeric-uid-value> -g <numeric-gid-value> -m -s /bin/bash
# example:
useradd orclmgmtagntusr -u 9200 -g 9100 -m -s /bin/bash
# Tip: Add useradd/groupadd to Dockerfile to create a nominated user during image development
The Oracle Management Agent older container files mentioned below are no longer actively maintained and they are kept in this repository for historical purposes only.
docker-images/OracleManagementAgent/dockerfiles/1.0.0
Notes:
To download and run the Oracle Management Agent, regardless whether inside or outside a container, you must download the binaries from the Oracle website and accept the license indicated at that page.
Oracle Linux is licensed under the Oracle Linux End-User License Agreement.
All scripts and files hosted in this project and GitHub docker-images/OracleManagementAgent
repository, required to build the container images are, unless otherwise noted, released under the UPL 1.0 license.
Oracle Management Agent container image is supported for the Linux images listed here. For more details please see My Oracle Support.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。