本人还在学习 docker 中,今天遇到一个问题,请大家帮我看一下下:
私有仓库搭建成功,能登陆,能下载上传
登陆:
[root@dockerma1 identidock]# docker login -u testuser -p testpassword registryv2:5043
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded
下载:
[root@dockerma1 identidock]# docker pull registryv2:5043/dnmonster:1.0
1.0: Pulling from dnmonster
.......
0bf866538d70: Pull complete
Digest: sha256:6886e348c47488377488ab0845845e99ba0e30e39df6cb3fd3a838beafe2ab57
Status: Downloaded newer image for registryv2:5043/dnmonster:1.0
[root@dockerma1 identidock]# curl -u testuser:testpassword https://registryv2:5043/v2/_catalog
{"repositories":["busybox","dnmonster","identidock","redis"]}
用 docker pull 都成功拉取,但是一用 docker-compose 拉镜像就失败
[root@dockerma1 identidock]# docker-compose up -d
Creating identidock_dnmonster_1...
Pulling redis (registryv2:5043/redis:3.0)...
Get https://registryv2:5043/v2/redis/manifests/3.0: no basic auth credentials
docker-compose.yml 文本内容:
[root@dockerma1 identidock]# cat docker-compose.yml
identidock:
image: registryv2:5043/identidock:1.0
ports:
- "5000:5000"
- "9000:9000"
environment:
ENV: DEV
links:
- dnmonster
- redis
dnmonster:
image: registryv2:5043/dnmonster:1.0
redis:
image: registryv2:5043/redis:3.0
请问 docker-compose 拉私有镜像要在 yml 里提供认证发式吗?还是我搭建认证的私有仓库有问题?(我就想用 docker-compose 来构建,不太想用 shell 脚本)