Failed to start Container after reboot I am hosting an own registry.
After rebooting the Server my registry container is unable to start.

I used this command to start the registry

docker run -d -p 5000:5000 --name registry -v /var/lib/registry/:/var/lib/registry -v /root/certs:/certs -v /root/auth/:/auth -eEGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt -e REGISTRY_HTTP_ADDR=0.0.0.0:5000 -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH=htpasswd" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" --restart always registry:2.7.1


After a reboot i get this message when i try "docker start registry":


  Error response from daemon: OCI runtime create failed: container with id exists: dfb0bef21bdfc8a89b59498befd37f83513e75527c0beb552e0400df2a2b7c7d: unknown
  Error: failed to start containers: registry


Starting a new container works fine.
How can a fix, it and sould the container not start by itself because of "--restart alway"

docker --version


Docker version 18.09.6, build 481bc77

Thx for your help.

Update

Intesting news I have written an init script to to the job,
but the problem is exactly the same.  The container exists but isn't started.
If I try to start it, I get the error message from above.

On the boot screen in get this information.


So the docker daemon seam to be not ready.
Do you have any suggestions why?
Try to check is registry really stopped using docker ps -a if container runned stop container then start.

Part related to the --restart always option, restart always will proceed only if container works at least 10 seconds and docker itself can monitor this service.

See more info at this link restart policy detail