ContainerConfig error

Errors when using docker-compose

Symptoms

When recreating a container, e.g. during an update, with docker-compose:

Recreating postgresql ...

ERROR: for postgresql  'ContainerConfig'
Traceback (most recent call last):
  File "/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[...]

    File "/usr/lib/python3/dist-packages/compose/service.py", line 1579, in get_container_data_volumes
    container.image_config['ContainerConfig'].get('Volumes') or {}
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'ContainerConfig'

Causes

As far as we know, docker changed something so that docker-compose does not work with containers that were created with an older version docker-compose.

But as docker-compose is considered deprecated and should be replaced with docker compose (note the missing - . It is now a plugin to docker instead of a stand-alone program named docker-compose), we just switch to docker compose instead of investigating the situation further with the deprecated docker-compose.

Solutions

Stop and remove all running containers. For good measure you can also restart the docker service, but for us this was not needed in all cases.

Make sure the docker plugin for compose is installed. E.g. in the Debian package docker-compose-plugin.

Create all desired containers, but with docker compose instead of docker-compose (Note the difference: -)

In our recommended installation page, we now recommend docker compose.

Our provided example maintain script now also uses docker compose, you can get the updated version like:

curl https://raw.githubusercontent.com/programmfabrik/fylr-gitbook/main/_assets/maintain -o maintain
chmod a+x maintain

Last updated