Updating a Docker container
Updating MikoPBX running in Docker or Docker Compose
We recommend updating sequentially, without skipping releases and versions.
A MikoPBX Docker container is not updated with .img or .iso files. To move to a new version, you need to download the new Docker image and recreate the container, preserving the /cf and /storage directories, network settings, and environment variables.
Preparation
Create a backup of the MikoPBX settings. If the backup module is unavailable in the unprivileged container, prepare backup of the directories or volumes on the Docker host side.
Write down the name and version of the current image:
sudo docker inspect mikopbx --format '{{.Config.Image}}'Save the current container configuration:
sudo docker inspect mikopbx > mikopbx-container-before-update.jsonCheck the
/cfand/storagemounts:
sudo docker inspect mikopbx --format '{{range .Mounts}}{{println .Source "->" .Destination}}{{end}}'Write down the ports in use,
network_mode, hostname, and environment variables. If the container is started via Compose, save the currentdocker-compose.ymland the.envfile.End active calls and schedule a maintenance window.
Updating a container started with the docker run command
Downloading the new image
For the latest stable version, run:
If a fixed tag is used, specify the same registry and the tag of the required version instead of latest.
Stopping and replacing the container
Stop the container:
Create a consistent backup of
/cfwhile the container is stopped. For the bind mount from the example above, you can run:
In addition to /cf, it is worth backing up the CDR database before the new version — it is located in /storage and may also be migrated on first start. /cf contains only mikopbx.db (the settings), while the call history is a separate cdr.db (and recording_storage.db) in /storage/usbdisk1/mikopbx/astlogs/asterisk/.
The backup must be made with the container stopped (as for /cf) so that the database is in a consistent state:
When rolling back, restore both archives: first /cf, then the CDR — otherwise the call history and the link between recordings and calls may get out of sync with the settings.
Rename the old container instead of deleting it immediately:
Start a new container with the same parameters. Example for an installation with host network and bind mounts:
The example must not be copied without verification. Repeat all the parameters of your exact previous installation: network type, volumes, ports, hostname, capabilities, and environment variables.
Monitor the startup:
To exit the log view, press Ctrl+C — the container will keep running.
Updating with Docker Compose
Go to the directory containing
docker-compose.yml.If user IDs are passed through the environment, set them the same way as on first launch:
Download the new image:
Recreate the container:
Check the status and logs:
Docker Compose will recreate the container but keep the bind mounts and named volumes specified in docker-compose.yml.
Verification after the update
Make sure the container is running:
Open the web interface and check the MikoPBX version.
Check that the settings and call recordings are in place.
Make sure the phones and SIP providers have registered.
Make a test inbound and outbound call.
Check the publishing of web, SIP, and RTP ports if a bridge network is used.
Rollback
If the new container does not start:
Save its logs:
Stop and rename the new container:
Restore the
/cfbackup created before the update. The restoration method depends on whether a bind mount, a named volume, or a storage snapshot is used.Give the old container its previous name back and start it:
On first start, the new version may have upgraded the database in /cf. Therefore, a reliable rollback must rely not only on the old container image but also on the /cf backup created before the update.
To roll back a Docker Compose installation, specify the previous image tag in docker-compose.yml, restore the previous state of /cf, and run again:
After successful verification, you can delete the old container:
Last updated
Was this helpful?

