<p>Try to check is <code>registry</code> really stopped using <code>docker ps -a</code> if container runned stop container then start.</p>

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

<p>See more info at this link <a href="https://docs.docker.com/config/containers/start-containers-automatically/#restart-policy-details" rel="nofollow noreferrer">restart policy detail</a></p>

CC BY-SA 4.0
2019-06-04T06:51:05.003Z
Yes, docker ps -a returns the registry, container. Restart always should start the container after the service is restarted and after a reboot this is the case.
Ace of Spade
CC BY-SA 4.0
2019-06-03T21:36:28.910Z
2019-06-03T21:36:28.910Z
Ivan Gurzhiy
<p>I am hosting an own registry.<br>
After rebooting the Server my registry container is unable to start.</p>

<p>I used this command to start the registry</p>

<pre><code>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
</code></pre>

<p>After a reboot i get this message when i try "docker start registry":</p>

<blockquote>
  <p>Error response from daemon: OCI runtime create failed: container with id exists: dfb0bef21bdfc8a89b59498befd37f83513e75527c0beb552e0400df2a2b7c7d: unknown
  Error: failed to start containers: registry</p>
</blockquote>

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

<pre><code>docker --version
</code></pre>

<p>Docker version 18.09.6, build 481bc77</p>

<p>Thx for your help.</p>

<h3>Update</h3>

<p>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.</p>

<p>On the boot screen in get this information.
<a href="https://i.sstatic.net/xAfdX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xAfdX.png" alt="enter image description here"></a></p>

<p>So the docker daemon seam to be not ready.<br>
Do you have any suggestions why?</p>

CC BY-SA 4.0
2019-05-28T09:56:39.027Z
https://docs.docker.com/engine/reference/commandline/start/
Tensibai
CC BY-SA 4.0
2019-05-28T10:11:23.137Z
I updated the post.
Ace of Spade
CC BY-SA 4.0
2019-05-28T23:56:38.140Z
What version of Docker are you on? There was a bug in 17.06 that may be related.
Zac Anger
CC BY-SA 4.0
2019-06-03T06:05:01.360Z
Added version info to the post.
Ace of Spade
<docker><docker-registry>
Failed to start Container after reboot
Ace of Spade
# Failed to start Container after reboot

(Asked by: username_0 on 2019-05-28)

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?

**Tags:** docker, docker-registry

> **Comments:**
> **username_1**: https://docs.docker.com/engine/reference/commandline/start/  
> **username_0**: I updated the post.  
> **username_2**: What version of Docker are you on? There was a bug in 17.06 that may be related.  
> **username_0**: Added version info to the post.  

---

## 1 answers

### Answer by username_3 on 2019-06-03. Score: 1

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](https://docs.docker.com/config/containers/start-containers-automatically/#restart-policy-details)

> **Comments:**
> **username_0**: Yes, docker ps -a returns the registry, container. Restart always should start the container after the service is restarted and after a reboot this is the case.  

---

