Skip to content

Files

Oracle Management Agent Container Image

Important: The container files version 1.0.0 require elevated privileges to create a local system account used to run the Oracle Management Agent. In secure environments it is less desirable to allow privilege escalation and therefore the container files version 1.0.0 found here are no longer maintained, they simply exist here for historical references. Please use the latest container files instead which provide a more secure way to run both the container and the Oracle Management Agent.

This repository contains sample container configurations 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.

How to build and run

Oracle Management Agent image uses the official oraclelinux:7-slim container image as the base image.

Prerequisites

  1. Download the Management Agent software

    Note: Select 'Downloads and Keys' then download 'Agent for LINUX (X86_64)' of the package type ZIP.

  2. Copy the downloaded bundle to the same directory as the Dockerfile

    > cp oracle.mgmt_agent.zip OracleManagementAgent/dockerfiles/1.0.0/
  1. Follow the steps in the Create Install Key and Configure a Response File sections of the Management Agent documentation to create an install key and save it locally as input.rsp.
  1. Copy the downloaded install key to the same directory as the Dockerfile

    > cp input.rsp OracleManagementAgent/dockerfiles/1.0.0/
  2. Change to the directory in which the Dockerfile for this container image is located

    > cd OracleManagementAgent/dockerfiles/1.0.0/
  3. Ensure your tenancy is configured correctly by applying the documented prerequisites for deploying management agents

Steps to build and run using Docker Compose

  1. Create .env file to populate the hostname variable

    > echo "mgmtagent_hostname=mgmtagent912" > .env

    Note: Chose a unique hostname as it will be used to identify Management Agent in the UI.

  2. Use Docker Compose CLI to build and run a container image

    > docker-compose up --build -d

Steps to build and run using Docker CLI

  1. Build the container image

    > docker build -t oracle/mgmtagent-container .
  2. Create a Docker volume to share configs with the container

    > docker volume create mgmtagent-volume
    
    # identify the mount point location to use in next steps
    > docker volume inspect mgmtagent-volume|grep Mountpoint
        "Mountpoint": "/var/lib/docker/volumes/mgmtagent-volume/_data",
  3. Copy the Install Key (input.rsp) into the shared Docker volume Mountpoint

    > mkdir -p /var/lib/docker/volumes/mgmtagent-volume/_data/mgmtagent_secret
    > cp input.rsp /var/lib/docker/volumes/mgmtagent-volume/_data/mgmtagent_secret/
  4. Start a container

    > docker run -d --name mgmtagent-container --hostname mgmtagent1 -v mgmtagent-volume:/opt/oracle:rw --restart unless-stopped oracle/mgmtagent-container:latest

    Description of Docker run parameters used above

    Parameter Description
    -d Starts mgmtagent-container in detached mode
    --name mgmtagent-container The name given to the container to identify it.
    --hostname mgmtagent1 Assign mgmtagent1 as the containers internal hostname. This can be any hostname compliant string and it will be used to identify the Management Agent instance in the OMC Console.
    -v mgmtagent-volume /opt/oracle:rw: Mounts the volume mgmtagent-volume created on host filesystem inside the container at /opt/oracle with Read/Write privileges.
    --restart unless-stopped Unless explicitly stopped, this restart policy restarts mgmtagent-container automatically when docker restarts.
  5. Remove the Install Key (input.rsp) from the shared Docker volume Mountpoint after verifying the new Management Agent is registered and visible in the main Management Agents page

    > rm  /var/lib/docker/volumes/mgmtagent-volume/_data/mgmtagent_secret/input.rsp

Steps to execute custom user operations

Users can provide custom shell script commands to execute before starting Management Agent as described in the following steps

  1. 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 Management Agent starts

  2. 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

Helpful administration commands

  1. Starting a stopped Management Agent Container

    > docker start mgmtagent-container
  2. Stopping a running Management Agent Container

    > docker stop mgmtagent-container
  3. Inspecting logs of Management Agent Container

    > docker logs mgmtagent-container
  4. Cleanup volume using Docker Compose

    > docker-compose down --volumes
  5. Cleanup volume using Docker CLI

    > docker volume rm mgmtagent-volume

License

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 Docker images are, unless otherwise noted, released under the UPL 1.0 license.

Support

Oracle Management Agent container image is supported for the Linux images listed here. For more details please see My Oracle Support.

Copyright

Copyright (c) 2023 Oracle and/or its affiliates.