June-4th-2019, 04:11 PM
(This post was last modified: March-27th-2020, 08:57 AM by Armin@netPI.)
"A tool for defining and running multi-container Docker applications", says the Docker Compose definition and yes it is indeed a second tool named "docker-compose" that needs to be installed next to "docker" tool to participate from deploying multiple containers at a time. On native machines it is no problem to post install docker-compose but on netPI it is not there.
But the good thing is deploying a stack of applications at a time is supported by netPI as well using the "stacks" feature of standard Docker. Lean more here about the difference between stacking and composing.
To use the stacks function on netPI open the Docker web GUI portainer.io and then click the menu item "Stacks". Click "+Add stack" and check the "Web editor" feature in the middle and copy and paste the content of your compose YAML file into the web editor frame. Finally click "Deploy the stack".
Since Docker compose often starts many containers at a time you have to patiently wait for downloading the container images the first time you use this function.
Here is how a typical compose file content looks like:
The example above configures and starts 4 containers in a single step:
But the good thing is deploying a stack of applications at a time is supported by netPI as well using the "stacks" feature of standard Docker. Lean more here about the difference between stacking and composing.
To use the stacks function on netPI open the Docker web GUI portainer.io and then click the menu item "Stacks". Click "+Add stack" and check the "Web editor" feature in the middle and copy and paste the content of your compose YAML file into the web editor frame. Finally click "Deploy the stack".
Since Docker compose often starts many containers at a time you have to patiently wait for downloading the container images the first time you use this function.
Here is how a typical compose file content looks like:
Code:
version: "2"
services:
codesys:
image: hilschernetpi/netpi-codesys-basis:1.0.1
network_mode: "host"
restart: always
devices:
- "/dev/vcio:/dev/vcio"
privileged: true
nodered:
image: nodered/node-red-docker:0.20.8-rpi
ports:
- "1880:1880"
networks:
- bridgeNetwork
restart: always
user: root
influxdb:
image: influxdb:1.7.8
restart: always
ports:
- "8086:8086"
networks:
- bridgeNetwork
environment:
- INFLUXDB_DB=db0
- INFLUXDB_ADMIN_ENABLED=true
- INFLUXDB_ADMIN_USER=admin
- INFLUXDB_ADMIN_PASSWORD=12345678
- INFLUXDB_USER=user
- INFLUXDB_USER_PASSWORD=12345678
grafana:
image: grafana/grafana:5.4.3
restart: always
ports:
- "3000:3000"
networks:
- bridgeNetwork
networks:
bridgeNetwork:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.30.0.0/24
gateway: 172.30.0.1
- CODESYS Soft PLC
- Grafana graphical tool
- Node-RED IoT tool
- InfluxDB database
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)