Ship with containers

Updating running docker container

Application containers should not store any data. In this way you can update your application container easily. Docker uses volumes as the preferred mechanism for persisting data. So its important you have created named volumes before upgrading your docker container.

In this example i have a running Portainer docker container, and i would like to update this instance to the latest version of portainer. Its available on the docker hub: ([ => portainer version 1.23.2] (https://hub.docker.com/r/portainer/portainer/))

executing the following commands accordingly:

docker pull image:latest
docker stop <<containername>>
docker rm <<containername>>
docker run --name //parameters

In de last command we should use the same -v parameters as we originally did. By only deleting the container no configuration data is deleted. Another more safe strategy is to create an latest container next to the existing one.