I am very new to Docker and currently trying to get my head around if there is any best practice guide to update software that runs inside a docker container in a very large distributed environment. I already found couple of posts around updating a MySQL database in docker, etc. It gives a good hint for any software that stores data, but what if you want to update other parts or your own software package or services that are distributed and used by several other docker images through docker-compose?
Is there someone with real life experience doing that in such an environment who can help me or other newbies to understand the best practices in docker if there are any.
Thanks for your help!
To verify, use the cat command to print the contents inside the file. In this way, you can use any editor of your choice to edit files inside the container. If you already have a container running in the background, you can even use the Docker exec command to get access to the bash of the container.
Run the new container with the docker run command and the name and the tag of the updated image that the container will need. In this example, the -it flag tells Docker to run the container in interactive mode, so you can run commands inside the container to verify any updated functionality.
Do not install software in /workdir in the Docker container, as the /workdir is a directory mounted from the host system. (It is the /workdir/<userID> directory on the host). Sometime, a software could take a long time to install. If your internet connection got interrupted in the middle when installing a software.
You never update software in a running container. You pull down a new version from the hub. If we assume you're using the latest tag (which is a bad idea, always pin your versions) of your image and it's one of the official library images or the publicly available that uses automated builds you'll get the latest version of the container image when you pull the image.
This assume you've also separated the data out of your container either as a host volume or using the data container pattern.
The container should be considered immutable, if you change it's state it's no longer a true version of the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With