For the complete documentation index, see llms.txt. This page is also available as Markdown.

Updating a Docker container

Updating MikoPBX running in Docker or Docker Compose

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

  1. 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.

  2. Write down the name and version of the current image:

sudo docker inspect mikopbx --format '{{.Config.Image}}'
  1. Save the current container configuration:

sudo docker inspect mikopbx > mikopbx-container-before-update.json
  1. Check the /cf and /storage mounts:

sudo docker inspect mikopbx --format '{{range .Mounts}}{{println .Source "->" .Destination}}{{end}}'
  1. Write down the ports in use, network_mode, hostname, and environment variables. If the container is started via Compose, save the current docker-compose.yml and the .env file.

  2. 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

  1. Stop the container:

  1. Create a consistent backup of /cf while 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.

  1. Rename the old container instead of deleting it immediately:

  1. Start a new container with the same parameters. Example for an installation with host network and bind mounts:

  1. Monitor the startup:

To exit the log view, press Ctrl+C — the container will keep running.

Updating with Docker Compose

  1. Go to the directory containing docker-compose.yml.

  2. If user IDs are passed through the environment, set them the same way as on first launch:

  1. Download the new image:

  1. Recreate the container:

  1. 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

  1. Make sure the container is running:

  1. Open the web interface and check the MikoPBX version.

  2. Check that the settings and call recordings are in place.

  3. Make sure the phones and SIP providers have registered.

  4. Make a test inbound and outbound call.

  5. Check the publishing of web, SIP, and RTP ports if a bridge network is used.

Rollback

If the new container does not start:

  1. Save its logs:

  1. Stop and rename the new container:

  1. Restore the /cf backup created before the update. The restoration method depends on whether a bind mount, a named volume, or a storage snapshot is used.

  2. Give the old container its previous name back and start it:

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?