Introduction

The JS7 - Controller Installation for Containers article explains start-up of a Controller container using the Docker® run command.

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

Examples have been contributed by the Japanese JS7 Community. The complete instructions can be found in 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-controller-primary:
    image: sosberlin/js7:controller-${JS7VERSION}
    hostname: js7-controller-primary
    volumes:
      - js7-controller-primary:/var/sos-berlin.com/js7/controller/var
    networks:
      - js7
    environment:
      RUN_JS_JAVA_OPTIONS: -Xmx256m
      RUN_JS_USER_ID: "${JS7USERID}:${JS7GROUPID}"
    restart: "no"

networks:

  js7:
    external: true

volumes:

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


Explanation:

  • Use of volumes: There are a number of ways of mounting or binding volumes into a container.
    • One strategy is to mount a Docker® volume which is managed by Docker®, typically in /var/lib/docker/volumes.
    • Another strategy is to map Docker® volumes to the local file system. This requires letting Docker® Compose know that the volume is locally managed and is in focus of the above example.
  • 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-controller-primary

Directory Hierarchy

Directories used with the Examples
. 
├── .env 
├── docker-compose.yml
└── js7-controller-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-controller-primary-1   "sh /usr/local/bin/e…"   js7-controller-primary   running             

Initial Operation

See JS7 - Controller Installation for Docker Containers, section: Initial Operation.



  • No labels