On Docker containers
There is a lot to know and learn about Docker containers. Some of the most important aspects when it comes to the Open Energy Playground are discussed here.
For more in-depth information, see the Docker Documentation
External Volumes
It is very important to understand the ephemeral nature of containers. This means that data created and stored within the container can disappear if the container restarts or is stopped.
For example, if we do not specify where the flows should be stored when running the node-RED container, they will be stored on the container itself. And the next time you restart the container, all you work will be LOST! Tragic!
To avoid this, the compose script (by default) maps the folder in the container that stores the flows to another folder on the host system. In the compose file, this is specified as the node-red folder within this project.
With this mapping in place, the flows are persistent beyond a restart.
Running containers and logging
You can see what containers are running with:
docker ps
And the images available with:
docker images
Port mapping
If deployed with this compose script, the ports from the containers are automatically mapped to the host.
Getting inside a container
If you want to run something custom inside an image, you can run:
docker exec -t -i [docker image] /bin/bash