Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

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

...

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

Preparation

Docker Compose Configuration: docker-compose.

...

yml

Download: docker-compose.yml

Code Block
languageyml
titleExample for use of Docker Compose with PostgreSQL
version: '3'

services:

  db:
    image: postgres:14-alpine
    volumes: 
      - db_data: /var/lib/postgresql/data
    ports:
      - "5432:5432"
    networks:
      - js7
    environment:
      POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --locale=en_US.UTF-8"
      POSTGRES_USER: js7user
      POSTGRES_PASSWORD: js7password
      POSTGRES_DB: js7db
    restart: "no"

  js7-joc-primary:
    depends_on:
      - db
    container_name: js7-joc-primary
    image: sosberlin/js7:joc-${JS7VERSION}
    hostname: js7-joc-primary
    ports:
      - "17446:4446"
    networks:
      - js7
    volumes:
      - js7-joc-primary-config:/var/sos-berlin.com/js7/joc/resources/joc
      - js7-joc-primary-logs:/var/sos-berlin.com/js7/joc/logs
    environment:
      RUN_JS_JAVA_OPTIONS: -Xmx256m
      RUN_JS_USER_ID: "${JS7USERID}:${JS7GROUPID}"
    restart: "no"

networks:

  js7:
    external: true

volumes:

  db_data:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}/db_data
      o: bind

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

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

...

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

Hibernate Configuration: hibernate.cfg.xml

...

Code Block
languagebash
titleEnvironment Variables used with the Examples
echo -e "JS7USERID=$(id -u)\nJS7GROUPID=$(id -g)\nJS7VERSION=2-35-20" > .env

# check environment variables
cat .env
JS7USERID=1000
JS7GROUPID=10000
JS7VERSION=2-35-20

Directories used with the Examples

Code Block
languagebash
titleDirectories used with the Examples
mkdir db_data
mkdir js7-agent-primary
mkdir js7-controller-primary
mkdir js7-joc-primary-config
mkdir js7-joc-primary-logs

...

Code Block
languagebash
titleDirectories used with the Examples
. 
├── .env 
├── db_data
├── docker-compose.yml
├── hibernate.cfg.xml
├── js7-agent-primary
├── js7-controller-primary
├── js7-joc-primary-config
└── js7-joc-primary-logs

...

Code Block
languagebash
titleExample how to restart the Container
# restart container
docker-compose restart js7-joc-primary

Initial Operation

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