我有一个标记为me/my-image的docker图像,我在dockerhub上有一个名为me-private的私人仓库.当我推动我/我的形象时,我最终总是打到公共回购.
将图像专门推送到私人仓库的确切语法是什么?
我想知道Docker的图像在我的本地主机中存储的位置.我可以在不使用Docker-Hub或者使用Dockerfile"真正的"Docker-Image的情况下共享我的Docker-Image吗?当我将Docker-Image推送到Docker-Hub时,究竟发生了什么?
我正在使用docker registry v1,我有兴趣迁移到更新的版本v2.但我需要一些方法来获取注册表中的图像列表; 例如,使用注册表v1,我可以执行GET请求,http://myregistry:5000/v1/search?结果是:
{
"num_results": 2,
"query": "",
"results": [
{
"description": "",
"name": "deis/router"
},
{
"description": "",
"name": "deis/database"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但我在官方文档上找不到类似的东西来获取注册表中的图像列表.有人知道在新版本v2上做到这一点的方法吗?
我运行一个私有的docker注册表,我想latest从存储库中删除所有图像.我不想删除整个存储库,只删除其中的一些图像.该API文档不提一个办法做到这一点,但肯定这是可能的?
默认情况下,如果我发出命令:
sudo docker pull ruby:2.2.1
Run Code Online (Sandbox Code Playgroud)
默认情况下,它会从docker.io官方网站上撤下.
Pulling repository docker.io/library/ruby
Run Code Online (Sandbox Code Playgroud)
如何将其更改为我的私人注册表.这意味着如果我发出
sudo docker pull ruby:2.2.1
Run Code Online (Sandbox Code Playgroud)
它将从我自己的私人注册表中提取,输出类似于:
Pulling repository my_private.registry:port/library/ruby
Run Code Online (Sandbox Code Playgroud) 我在a中使用RUN指令Dockerfile来安装rpm
RUN yum -y install samplerpm-2.3
Run Code Online (Sandbox Code Playgroud)
但是,我想传递值"2.3"作为参数.我的RUN指令应该类似于:
RUN yum -y install samplerpm-$arg
Run Code Online (Sandbox Code Playgroud)
哪里 $arg=2.3
我在CentOS上运行了一个docker 1.12.我试图添加不安全的注册表,文档中提到的东西不起作用.系统使用systemd所以我创建了一个/etc/systemd/system/docker.service.d/50-insecure-registry.conf文件.
$ cat /etc/systemd/system/docker.service.d/50-insecure-registry.conf
[Service]
Environment='DOCKER_OPTS=--insecure-registry="hostname.cloudapp.net:5000"'
Run Code Online (Sandbox Code Playgroud)
加载守护程序并重新启动docker服务后,systemd会显示环境变量
$ sudo systemctl show docker | grep Env
Environment=DOCKER_OPTS=--insecure-registry="hostname.cloudapp.net:5000"
Run Code Online (Sandbox Code Playgroud)
但是,当我运行时,docker info我没有看到添加了不安全的注册表
$ docker info
........
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Insecure Registries:
127.0.0.0/8
Run Code Online (Sandbox Code Playgroud)
推送图像hostaneme.cloudapp.net失败
Pushing application (hostname.cloudapp.net:5000/application:latest)...
The push refers to a repository [hostname.cloudapp.net:5000/mozart_application]
ERROR: Get https://hostname.cloudapp.net:5000/v1/_ping: http: server gave HTTP response to HTTPS client
Run Code Online (Sandbox Code Playgroud)
有什么可以做的吗?我错过了什么吗?
UPDATE
通过添加/etc/docker/daemon.json包含以下内容的文件解决了该问题
{
"insecure-registries" : [ "hostname.cloudapp.net:5000" ]
}
Run Code Online (Sandbox Code Playgroud)
然后重启docker
sudo …Run Code Online (Sandbox Code Playgroud) 我找不到将docker运行容器从一个主机移动到另一个主机的方法.
有没有什么方法可以将我的容器推送到存储库,就像我们为图像做的那样?目前,我没有使用数据卷来存储与容器内运行的应用程序相关联的数据.所以有些数据驻留在容器中,我想在重新设计设置之前保留这些容器.
我正在尝试使用以下图像设置私有docker注册表:https: //github.com/docker/docker-registry
只需运行:
docker run -p 5000:5000 registry
我只能从localhost拉/从这个存储库推送/但是如果我尝试从另一台机器上访问它(使用同一局域网上的私有地址),它会失败并显示错误消息:
*2014/11/03 09:49:04 Error: Invalid registry endpoint https ://10.0.0.26:5000/v1/':
Get https:// 10.0.0.26:5000/v1/_ping: Forbidden. If this private
registry supports only HTTP or HTTPS with an unknown CA certificate,
please add `--insecure-registry 10.0.0.26:5000` to the daemon's
arguments. In the case of HTTPS, if you have access to the registry's
CA certificate, no need for the flag; simply place the CA certificate
at /etc/docker/certs.d/10.0.0.26:5000/ca.crt*
Run Code Online (Sandbox Code Playgroud)
令我发疯的是我可以使用:curl 10.0.0.26:5000
和/或成功访问它
curl 10.0.0.26:5000/v1/search
我也不明白我应该在哪里以及如何通过--insecure-registry国旗.
一旦所述图像在相应的注册表中更新后,使我的Amazon ECS任务更新其Docker镜像的正确方法是什么?