Docker is starting an old Image

Moin,

A few years ago I was intensively involved with docker and docker compose and then built some images based on Ubuntu 18:04. They started easily with docker-compose.

Now I wanted to bring it up to date with ubuntu 22:04. So I adapted the Dockerfiles and called

docker-compose up --force-recreate

the images were rebuilt. But: If I start them with

docker-compose start

the old images will be started. Easy to see after logging into the container and looking in /etc/debian_version.

Clearly I forgot about the years when I wasn’t working with Docker. How can I force the new version to start?

Thanks

1 Like

It doesn’t rebuild the image, only recreates it. For example if you edited files in the container’s filesystem, recreating resets everything. If you want to rebuild images and start the containers from the new image, run

docker compose up --build

See

docker compose up --help
      --build                     Build images before starting containers.
      --force-recreate            Recreate containers even if their configuration and image
                                  haven't changed.
1 Like