Introduction

The JS7 - Agent Installation for Containers article explains start-up of an Agent container using the Docker® Run command.

The following examples apply for users who wish to start containers using the docker-compose utility. Consider that examples have to be adjusted to individual environments.

Examples are contributed by the Japanese JS7 Community. Find the complete instructions from the Start with JS7 JobScheduler docker-compose (MySQL version) article.

Preparation

Docker Compose Configuration: docker-compose.yml

Download: docker-compose.yml

Example for use of Docker Compose
version: '3'

services:

  js7-agent-primary:
    image: sosberlin/js7:agent-${JS7VERSION}
    hostname: js7-agent-primary
    volumes:
      - js7-agent-primary:/var/sos-berlin.com/js7/agent/var_4445
    networks:
      - js7network
    environment:
      RUN_JS_JAVA_OPTIONS: -Xmx256m
      RUN_JS_USER_ID: "${JS7USERID}:${JS7GROUPID}"
    restart: "no"

networks:

  js7:
    external: true

volumes:

  js7-agent-primary:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}/js7-agent-primary
      o: bind


Explanation:

  • Use of volumes: There are a number of ways how to mount or bind volumes into a container.
    • One strategy is to mount a Docker® volume that is managed by Docker® typically in /var/lib/docker/volumes.
    • Another strategy is to map Docker® volumes to the local file system. This requires to let Docker® Compose know that the volume is locally managed. This is what the above example is focused on.
  • Use of user accounts: see JS7 - Running Containers for User Accounts.
    • The RUN_JS_USER_ID setting holds the User ID and Group ID. Consider that the Group ID has to be 0  as directories and files in the image are owned by the root group.

Environment Variables used with the Examples

Environment Variables used with the Examples
echo -e "JS7USERID=$(id -u)\nJS7GROUPID=$(id -g)\nJS7VERSION=2-5-0" > .env

# check environment variables
cat .env
JS7USERID=1000
JS7GROUPID=0
JS7VERSION=2-5-0

Directories used with the Examples

Directories used with the Examples
mkdir js7-agent-primary

Directory Hierarchy

Directories used with the Examples
. 
├── .env 
├── docker-compose.yml
└── js7-agent-primary

Container Start-up

Start Container

Example how to start up Containers
docker-compose up -d

# check containers
$ docker-compose ps
NAME                            COMMAND                  SERVICE                  STATUS              PORTS
js74-js7-agent-primary-1        "sh /usr/local/bin/e…"   js7-agent-primary        running             



  • No labels