Cold upgrade a docker container from a new image

Table of contents

Overview

In cases where updating via API is not possible, an upgrade operation with replacing the docker image and recreating the container is required.

All data stored in the database, as well as files and directories in the volumetrics on the host, remain intact and are retained and used after the new version of the system is started.

Upgrade procedure

Step 1. find out the current name of the platform container. This is the name of the "era<Postfix>" format given when the system was installed or during a past upgrade.

It can be detected by running the command:

docker ps -a

and finding the active container with the specified name format.

Step 2: Generate a container startup string. You can manually build from a template from the installer or if you have internet run the command:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock assaflavie/runlike <CurrentContainerName>

replacing "<CurrentContainerName>" with the name of the current container figured out in the previous step.

Remember the generated long command, you will need it in the item 5.

IMPOrTANT: Check if the "--restart unless-stopped" parameter is present in the resulting command. Without it, the container will not start after a future update.

Step 3: Upload a new image

docker load -i <ImageFileName>

replacing "<ImageFileName>" with the name of the docker image with the new version. The image has a format name "era_<VERSION>_docker.tar.gz".

Step 4. stop the current container:

docker container stop <CurrentContainerName>

Step 5: Start a new container

Execute the command from step 2, replacing the container name with the new one. For example, if the original team was:

docker run --name era<Postfix1> ...

it becomes:

docker run --name era<Postfix2> ...

The new container name is necessary to be able to quickly rollback to a previous version. A second container with the same name cannot be created and started. After starting and checking the correct state, the previous container can be deleted.

Step 6: Set the time zone inside the container

unlink /etc/localtime

ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime

Step 7: Check possible links to other directories

era_meet: in the working directory "/var/lib/era/<MeetNode>/"