In the title
… images are missing after docker compose upgrade
That is impossible. Docker compose is just a client. It has nothing to do with the data handled by Docker CE. Now you mention upgading Docker in the content. Choosing a proper title is essential if you want to get help without leaving people confused. Volume names could indeed change after a compose upgrade if the project folder had some characters that handled differently in the new compose.
If you upgraded Docker from an old version that used a different storage driver, or just lost the /etc/docker/daemon.json
file after the upgrade which contained the setting of a different storage driver, the new Docker will store files in a different folder and you need to change the storage driver back assuming it is still supported.
The other reason could be a changed docker data root path. Tht is also set in the daemon.json
but by default it is /var/lib/docker
Check the content of the data root
sudo ls $(docker info --format '{{ .DockerRootDir }}')
Assuming you use Docker CE and not Docker Desktop, it should show the folders in the data root
buildkit containers engine-id image network overlay2 plugins runtimes swarm tmp volume
If you see “overlay” instead of “overlay2” or you see any other folder that has lots of data and not in my output, that could mean the storage driver changed.
Even if the storage driver changed, that would not affect named volumes. So it could be the change of the data root and you need to find out what was the old one.
You can search for the engine-id
file for example:
sudo find / -name engine-id
My output:
/home/ubuntu/.local/share/docker/engine-id
/var/lib/docker/engine-id
As you can see, the docker data root can be in your home if you have or had a rootless Docker context. Current contexts show in the output of
docker context ls
The context help can show you how to switch, but: docker context use CONTEXTNAME
Then see if your data is back.
Also, @bluepuma77’s suggestion can reveal if you just have a different volume name and the old one is still there just for example with a dash instead of an unuderscore or your project name changed and the missing volume data has nothing to do with a docker upgrade, but the fact that each volume in a swarm stack or compose project is prefixed with the project name. If your old volume still exists, you can restore the data. If not, your data is probably lost and hopefully you had a backup from which you can still restore most of your data.