Starting new with docker, there are a lot of open questions that are not covered by the buzz word explanations on the internet. I will try to find brief but concrete answers to the following questions:
How does docker integrate with my buildserver (e.g. jenkins)?
What is a typical Docker dev pipeline like?
How can I use docker on my development PC? Does my IDE allow me to build images?
How do I add configuration to a docker images/container?
Concrete: I want to adjust the catalina.sh from a tomcat inside a container.
Where/when/how are passwords, certificates or even less sensitive, but environment dependend values added?
You use Docker Swarm mode which comes with Docker Secret. In short – swarm is managing multiple docker nodes, to distribute containers over a multiple servers. Swarm can also be used on the same machine as the docker node and can only have one node (which we will use).
Swarm safes the passwords/secrets encrypted and send’s them on startup of a container over a secured TLS connection to the node. The node mounts an „in memory“ file in the running container and thus shares the secrets/passwords. On teardown of the container, the file is unmounted and removed from the nodes cache.
See: https://docs.docker.com/engine/swarm/secrets/#build-support-for-docker-secrets-into-your-images
How to handle stateful applications like databases?
Do not include the state in the image. Mount a shared system volume where the database data is stored. This way each docker container has access to the same data and they remain stateful. Dockerize only the accessing application e.g. MySQL.
E.G:
docker run -dit -v /var/myapp/data:/var/lib/postgresql/data postgres
See
https://success.docker.com/Architecture/Docker_Reference_Architecture%3A_Development_Pipeline_Best_Practices_Using_Docker_EE and
https://docs.docker.com/engine/tutorials/dockervolumes/#mount-a-host-directory-as-a-data-volume