我从systemd/dockerd
收到此消息:
Dec 29 14:41:32 core-01 systemd[1]: Starting ElasticSearch...
Dec 29 14:41:32 core-01 docker[1335]: Error response from daemon: No such container: es
Dec 29 14:41:32 core-01 docker[1346]: Error response from daemon: No such container: es
Dec 29 14:41:33 core-01 docker[1367]: Pulling repository prv.private.registry/elasticsearch-qa
Dec 29 14:41:33 core-01 docker[1367]: Error: image elasticsearch-qa not found
Dec 29 14:41:33 core-01 systemd[1]: living-es.service: Control process exited, code=exited status=1
所以它告诉我image elasticsearch-qa not found
。
systemd服务定义是:
- name: living-es.service
command: start
enable: true
content: |-
[Unit]
Description=ElasticSearch
Author=Living
After=docker.service
[Service]
Restart=always
RestartSec=10s
ExecStartPre=-/usr/bin/docker stop es
ExecStartPre=-/usr/bin/docker rm es
ExecStartPre=/usr/bin/docker pull prv.private.registry/elasticsearch-qa:v1
ExecStart=/usr/bin/docker run --name es -p 9200:9200 -p 9300:9300 --hostname es -v /home/core/data/es:/usr/share/elasticsearch/data prv.private.registry.com/elasticsearch-qa:v1 -Des.node.name="esn1" -Des.cluster.name="cluster"
ExecStop=/usr/bin/docker stop es
信息很明显,然而,当我将图像拉到外壳上时,它被正确拉出。有什么想法吗?
docker pull prv.private.registry/elasticsearch-qa:v1
v1: Pulling from elasticsearch-qa
8ad8b3f87b37: Pull complete
751fe39c4d34: Pull complete
b165e84cccc1: Pull complete
acfcc7cbc59b: Pull complete
04b7a9efc4af: Pull complete
b16e55fe5285: Pull complete
8c5cbb866b55: Pull complete
53c3dd7fc70d: Pull complete
3de13756a8c8: Pull complete
64be422416b7: Pull complete
b808918635ce: Pull complete
5b3ceec8c156: Pull complete
561269d0b7cc: Pull complete
0c6cf9533753: Pull complete
5234b57e3d12: Pull complete
4a86b042378a: Pull complete
c6f98581a18c: Pull complete
b6ee1115f29d: Pull complete
Digest: sha256:1f3c29d4f10ae897f67067ff72b8e25d8380531f04637941e67747bec96228f9code=exited status=1
Status: Downloaded newer image for prv.private.registry/elasticsearch-qa:v1
答案 0 :(得分:2)
尝试以docker pull
手动运行root
命令,因为那是systemd正在运行的用户。它可能无法对您的私人仓库进行身份验证,因为凭据存储在您的用户首选项中。
如果是这种情况,请尝试将User=yourusername
添加到您的systemd
单元文件中。