Updating docker

Updating your Kimai docker image

BACK UP EVERYTHING. The database, the mounted volumes, everything. Please. Pretty please.

While this process (almost) always works there can be errors, and we really don’t want you to lose any data.

The apache image

Just change the tag name and restart the image.

The fpm image

The FPM image will need to be upgraded with a manual step. Because the FPM image will have a HTTP proxy (normally nginx) container serving the static assets the public directory is mounted into that nginx container. This is done via volumes:

version: '3.5'
services:
    kimai:
        image: kimai/kimai2
        ...
        volumes:
            - public:/opt/kimai/public
        ...
    nginx:
        ...
        volumes:
            - public:/opt/kimai/public:ro
    ...

When the kimai image is updated, and the container is restarted any new assets in the public directory are never included. These will be things like CSS files, images and especially version specific javascript code! To fix this you need to copy the newer files from a fresh image over the top.

# You might need to use `docker volume ls | grep kimai` and see how your Kimai public volume really is named on your system!
me@myhost $ docker run --rm -ti -v kimai_public:/public --entrypoint /bin/bash kimai/kimai2
#                                  ^^^^^^^^^^^^ -> Kimai public volume
bash-5.0$ cp -r /opt/kimai/public /
bash-5.0$ exit
me@myhost $

Now you’ll need to tell the running kimai to update its assets:

me@myhost $ docker-compose exec kimai /opt/kimai/bin/console assets:install

That should do it.

Top