使用docker-compose从私有存储库中提取图像 [英] Use docker-compose to pull images from private repository

查看:289
本文介绍了使用docker-compose从私有存储库中提取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用docker-compose命令运行多个容器.问题是我的docker-compose必须从公共存储库中提取一些图像,并从私有存储库中提取一些图像.我打算做的是将所有必需的映像推送到私有存储库,但是如何使docker-compose从私有存储库中提取映像.

I'm using docker-compose command to run multiple containers. The problem is my docker-compose has to pull some images from the public repository and some from a private repository. What I'm planning to do is push all required images to the private repository but how can I make docker-compose pull the images from the private repository.

简而言之->当图像仅在专用存储库中时如何指向该专用存储库

In short -> How to point to a private repository when the images are only available there

推荐答案

使用docker login命令. (官方文档)
输入您的凭据,然后只有在具有访问权限的情况下,您才能提取私有图像.

Use docker login command. (Official doc)
Enter your credentials, and then you can pull private image, only if you have an access.

如果要登录自托管注册表,可以通过添加服务器名称来指定.

If you want to login to a self-hosted registry you can specify this by adding the server name.

docker login localhost:8080

感谢 @herm的注释,如果要使用群体,请使用: --with-registry-auth选项. 从个性上讲,我使用以下命令:

Thanks to @herm's comment, if you want to use swarm, use : --with-registry-auth option. Personnaly, I use this command :

docker stack deploy --with-registry-auth --compose-file dev.compose.yml myProjectName

这篇关于使用docker-compose从私有存储库中提取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆