Update local Docker images

To run a local OneCX instance, Docker images with the latest version are downloaded. Over time, these images become outdated, meaning that even if a newer version is available, the old version is still being used locally. Check versions with script check-images.sh.

The update-images.sh script is used to renew local Docker images. It can be run from the root directory of the onecx-local-env repository.

Here is the command to display the available flags:

./update-images.sh -h

To get an overview of the Docker images and their versions on your local machine, run the Docker command docker image ls. If images with the tag <none> are displayed, you can run the script with the parameter -c to clean them up.

After successfully updating the images, it is recommended to clean up outdated Docker resources using the command

docker system prune

Available Flags

The script accepts several optional flags to customize its behavior. The available flags are:

-c

Cleaned up orphaned images (e.g. if they have <none> in their name)

This option can be used in combination with -n or separately. If used without a name filter, all orphaned images will be removed. No additional confirmation is required.

-h

Displays help information about the script and its available flags. If used then all other options are ignored.

-n <text>

Name filter, update images which have <text> into image name

Examples

Update UI Images

The Docker which have ui in image name are pulled from remote registry.

./update-images.sh  -n ui

Cleanup only

Started without any name filter will remove all orphaned images. No additional confirmation is required.

script check images.sh none images
Figure 1. Excerpt from the list of orphaned images
./update-images.sh  -c

The deletion is only possible if the image is not in use. If so then stop the appropriate container first and try again.

script check images.sh rm image failed
Figure 2. Image deletion failed