Filesystem rootdirectory confusion

I’m a bit confused about where the actual registry storage lives when you use the default filesystem:rootdirectory=/var/lib/registry. It seems like the storage is inside the container, because when I stop and remove the container then start it up again, any images that were in the registry before are completely gone. Does this mean I should be creating a volume somehow so the rootdirectory ends up pointing to a “real” dir outside the container in the host file system? Please clarify/advise.



Please share HOW you start your registry.

oh yeah, duh. Here:
docker run -d --restart=always --name registry -v “$(pwd)”/certs:/certs -e REGISTRY_STORAGE_DELETE_ENABLED=true -e REGISTRY_HTTP_ADDR= -e REGISTRY_HTTP_TLS_CERTIFICATE=certs/amsdevlsdr01.crt -e REGISTRY_HTTP_TLS_KEY=certs/amsdevlsdr01.key -p 443:443 registry:2

Yep, like i though, you are in fact storing the data inside the container.
You need to add a -v /path/on/host:/var/lib/registry to your docker run command in order to persist the data outside your container. Replace /path/on/host with an existing valid path on your host.

Thanks much, that fixed it.