59

Running Ubuntu server 22.04.4 LTS.

Today I did an apt update and apt upgrade which ran through a few updates, and then I pulled new docker images via docker-compose pull. After I tried to restart the containers via docker-compose, I got a bunch of errors regarding container config and many of the containers refused to start. Then when I run docker ps -a, I see a bunch of the container names have changed to include a random string of characters before the prior name (e.g. swag is now 5f6bfe94c235_swag). I didn't change anything in the docker-compose.yml file and it had been working fine before this.

When I run sudo docker-compose up -d, I get the following output:

Traceback (most recent call last):
      File "/usr/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/cli/main.py", line 81, in main
        command_func()
      File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 203, in perform_command
        handler(command, command_options)
      File "/usr/lib/python3/dist-packages/compose/metrics/decorator.py", line 18, in wrapper
        result = fn(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1186, in up
        to_attach = up(False)
      File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1166, in up
        return self.project.up(
      File "/usr/lib/python3/dist-packages/compose/project.py", line 697, in up
        results, errors = parallel.parallel_execute(
      File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute
        raise error_to_reraise
      File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer
        result = func(obj)
      File "/usr/lib/python3/dist-packages/compose/project.py", line 679, in do
        return service.execute_convergence_plan(
      File "/usr/lib/python3/dist-packages/compose/service.py", line 579, in execute_convergence_plan
        return self._execute_convergence_recreate(
      File "/usr/lib/python3/dist-packages/compose/service.py", line 499, in _execute_convergence_recreate
        containers, errors = parallel_execute(
      File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute
        raise error_to_reraise
      File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer
        result = func(obj)
      File "/usr/lib/python3/dist-packages/compose/service.py", line 494, in recreate
        return self.recreate_container(
      File "/usr/lib/python3/dist-packages/compose/service.py", line 612, in recreate_container
        new_container = self.create_container(
      File "/usr/lib/python3/dist-packages/compose/service.py", line 330, in create_container
        container_options = self._get_container_create_options(
      File "/usr/lib/python3/dist-packages/compose/service.py", line 921, in _get_container_create_options
        container_options, override_options = self._build_container_volume_options(
      File "/usr/lib/python3/dist-packages/compose/service.py", line 960, in _build_container_volume_options
        binds, affinity = merge_volume_bindings(
      File "/usr/lib/python3/dist-packages/compose/service.py", line 1548, in merge_volume_bindings
        old_volumes, old_mounts = get_container_data_volumes(
      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'

I'm able to manually start the containers by using the command:

sudo docker start <container_name>

Restarting the docker service and restarting the computer didn't fix it. Any idea what broke with this update and how I can fix it?

4

6 Answers 6

91

Same here. After changing from docker-compose to docker compose it works with no other changes.

Now, my containers are running with:

docker compose up -d

instead of:

docker-compose up -d

This is because docker-compose is the V1 syntax, which is now deprecated. The V2 syntax is docker compose, since it's now a plugin and not a separate command.

1
  • Upgrading to ubuntu 24.04 LTS can leave you in a state where docker-compose is broken and the v2 docker compose plugin isn't installed ( see bug ). On 24.04 LTS it can be installed with sudo apt-get install docker-compose-v2.
    – yoyoma2
    Commented Apr 26 at 23:49
13

I ran into the same problem today.

docker-compose down

It worked for me

1
  • Be careful, if you have a local development DB this command can remove its data, so you have to set it up again from scratch
    – jgosar
    Commented Mar 22 at 12:20
7

..and if, like me, you were calling docker-compose via ansible then you'll need to upgrade

community.docker.docker_compose:

to

community.docker.docker_compose_v2:

and possibly make some other changes that follow, e.g. I had to change "pull: true" to "pull: always"

1

You may need to remove the stopped container first.

$ docker ps -a | grep -i Exited

and try again with $ docker-compose up -d

It may caused by you didn't stop before recreating a container. The proper command sequence may look like this.

$ docker-compose down
$ docker-compose up -d
0

Sometimes you got this because you have running containers. I got this error once with my ansible playbook and this works for me.

    - name: stopping existing container
      shell:
        chdir: "your path"
        cmd: "docker-compose down"

    - name: waiting 30 secondes to let the container stop
      ansible.builtin.pause:
        seconds: 30

    - name: deploy Docker Compose stack
      shell:
        chdir: "your path"
        cmd: "docker-compose build && docker-compose up -d"
2
  • You're still using docker-compose, which is no longer a supported syntax for Docker Compose - See here. Commented Mar 22 at 12:42
  • yes I know but it works for me. I'm using docker-compose 3. You can use docker compose down as well. it's equivalent Just remove all the existing container and run it again.
    – thierry14
    Commented Mar 23 at 21:17
0
sudo docker-compose rm -f
sudo docker-compose up

I used these commands to fix this error, but first, it's better to check if there are all the installed certificates and the docker itself.

New contributor
Анна Петрівна Якимова is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • 1
    Welcome to Ask Ubuntu! "We're a little bit different from other sites." Your answer could be improved with additional supporting information. If possible, please edit your post to add further details, such as explanations or documentation, so that others can understand how to solve the problem. You can find more information in How do I write a good answer? - "Brevity is acceptable, but fuller explanations are better." It might be helpful to review some highly upvoted answers as examples to follow. Thanks! Commented Aug 7 at 11:42
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 7 at 11:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .