我使用非常(8行)长的参数列表运行了一个Docker容器:
docker run -d -p 5000:5000 --restart=always --name registry \
-v `pwd`/auth:/auth \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \
registry:2
我确认这是通过docker ps运行的:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ff9c654bfc39 registry:2 "/bin/registry /etc/d" 2 days ago Up 13 minutes 0.0.0.0:5000->5000/tcp registry
然后我通过docker stop ff9c654bfc39停止了这个容器.然后,我尝试通过发出与第一次完全相同的docker run …(8班轮)来重新运行容器:
Error response from daemon: Conflict. The name "registry" is already in use by container ff9c654bfc39. You have to delete (or rename) that container to be able to reuse that name.
所以那时我只是尝试了docker restart ff9c654bfc39,这似乎有效,但我不是百分之百确定Docker“记得”我最初运行容器时的8行参数.关于它是否记忆的任何想法?如果没有,那么包含那8行的正确重启命令是什么?
最佳答案
原文链接:https://www.f2er.com/docker/436831.html