. . .

Docker Compose

Content


Preparations

Docker Compose only needs to be installed on the Linux operating system. Other operating systems already have Docker Compose installed by the Docker Toolbox.

# on linux with root rights
curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

You can find more information about this on the installation page of Docker Compose.

Configuration file

Docker Compose needs a docker-compose.yaml file for its configuration. You can also configure ApiOmat environment variables within this yaml file.

version: '3'
services:
mongo:
image: apiomat/mongo-conf:3.4
environment:
USE_SMALL_FILES: "true"
STORAGE_ENGINE: mmapv1
user: root
volumes:
- apiomat-mongo:/data
yambas:
image: apiomat/alpine-yambas:x.x.x
user: root
environment:
DEBUG: "true"
common_hosts_admin: http://localhost:8081
common_hosts_live: http(s)://<external address>
common_hosts_staging: http(s)://<external address>
common_hosts_test: http(s)://<external address>
common_isEnterpriseInstallation: "true"
DISABLE_HAZELCAST_MULTICAST: "true"
yambas_mongodb_hosts_default: mongo:27017
yambas_license_key: <your_license_key>
yambas_configEncryptionKey: <your_config_encryption_key_min_16_chars>
 LOG4J_LEVEL_APIOMAT: info
LOG4J_LEVEL_MONGODB: error
LOG4J_LEVEL_JERSEY: error
LOG4J_LEVEL_HAZELCAST: info
dashboard:
image: apiomat/alpine-dashboard:x.x.x
user: root
environment:
DEBUG: "true"
 common_hosts_admin: http://localhost:8000
common_hosts_live: http(s)://<external address>
common_hosts_staging: http(s)://<external address>
common_hosts_test: http(s)://<external address>
common_isEnterpriseInstallation: "true"
yambas_mongodb_hosts_default: mongo:27017
ports:
- 8000:8000
volumes:
apiomat-mongo:

CLI

With the following commands you can control the ApiOmat docker containers.

# create volume
docker volume create --name=data-db
# start docker-compose stack
docker-compose -f .\docker-compose.yml -p "apiomat" up
# stop docker-compose stack
docker-compose -f .\docker-compose.yml -p "apiomat" stop
# remove docker-compose stack
docker-compose -f .\docker-compose.yml -p "apiomat" rm -f

Further information about the docker-compose CLI can be found here.

The following is an excerpt from the docker ps command after executing docker-compose up:

images/download/attachments/91600901/2017-10-09-14_54_27-runMasterYaml.bat---alpine---Visual-Studio-Code.png
Docker PS of docker-compose

The next picture shows the Docker statistics (docker stats) of the docker-compose:

images/download/attachments/91600901/2017-10-09-14_57_24-runMasterYaml.bat---alpine---Visual-Studio-Code.png

  1. Container (9eea03aa3dc5) is alpine-dashboard

  2. Container (9f98b8f03536) is alpine-dashboard

  3. Container (2ac02af2ee50) is mongo-conf