Docker私有注册表状态永远在“Restarting(1)”中

时间:2016-05-18 13:53:08

标签: linux ssl docker registry devops

我使用下面的命令在OEL6中使用注册表:2图像设置了一个docker私有注册表。

docker run -d -p 5000:5000 --restart=always --name bkdevregistry -v /var/lib/docker/certs/:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/xx.yy.com.crt -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/xx.yy.com.key registry:2

我已按照官方指南创建证书并设置注册表。

系统因维护活动而重新启动,重启后,注册表容器根本无法运行。它会立即进入Restarting (1)状态,并且不会更改其状态。

[root@slcn09vmf0022 ~]# docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                         PORTS                    NAMES
44ad9d09d210        registry:2          "/bin/registry /etc/d"   9 minutes ago       Restarting (1) 3 minutes ago   0.0.0.0:5000->5000/tcp   blkdevreg

任何使其恢复正常的建议将不胜感激。

日志:

time="2016-05-18T15:29:34Z" level=fatal msg="open : no such file or directory"
time="2016-05-18T17:18:47Z" level=warning msg="No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable." go.version=go1.5.3 instance.id=7034ae26-a1e8-4bc4-828a-be38d17a7ebb version=v2.3.1
time="2016-05-18T17:18:47Z" level=info msg="redis not configured" go.version=go1.5.3 instance.id=7034ae26-a1e8-4bc4-828a-be38d17a7ebb version=v2.3.1
time="2016-05-18T17:18:47Z" level=info msg="Starting upload purge in 51m0s" go.version=go1.5.3 instance.id=7034ae26-a1e8-4bc4-828a-be38d17a7ebb version=v2.3.1
time="2016-05-18T17:18:47Z" level=info msg="using inmemory blob descriptor cache" go.version=go1.5.3 instance.id=7034ae26-a1e8-4bc4-828a-be38d17a7ebb version=v2.3.1

2 个答案:

答案 0 :(得分:1)

docker run -d -p 5000:5000 --restart =总是--name bkdevregistry -v / var / lib / docker / certs /:/ certs -e REGISTRY_HTTP_TLS_CERTIFICATE = / certs / xx.yy.com.crt -e REGISTRY_HTTP_TLS_CERTIFICATE = / certs / xx.yy.com.key注册表:2

该问题是由于CERT和KEY都错误地使用了REGISTRY_HTTP_TLS_CERTIFICATE环境变量。

对于密钥使用REGISTRY_HTTP_TLS_KEY

答案 1 :(得分:0)

尝试删除docker注册表并重新启动docker service和iptables,然后使用注册表重新运行docker private registry:2,使用docker logs container_id查看日志中重复的错误