docker 组合、流浪和不安全的存储库
docker compose, vagrant and insecure Repository
我已设置 docker-compose 从自定义存储库中提取图像。
这是 yaml 文件的样子
my_service:
image: d-myrepo:5000/mycompany/my_service:latest
ports:
- "8079:8079"
现在如果我 运行 vagrant up,它会出错
==> 默认值:文件“/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth”,第 46 行,在 expand_registry_url
==> 默认值:docker.errors
==> 默认值:.
==> 默认值:DockerException
==>默认值::
==> 默认值:未启用 HTTPS 端点无响应和不安全模式。
以下 SSH 命令以非零退出状态响应。
Vagrant 认为这意味着命令失败!
/usr/local/bin/docker-compose -f "/vagrant/docker-compose.yml" up -d
Stdout from the command:
Stderr from the command:
stdin: is not a tty
Creating vagrant_y2y_1...
Pulling image d-myrepo:5000/mycompany/my_service:latest...
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 464, in up
File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 208, in up
File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 214, in recreate_containers
File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 197, in create_container
File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 710, in pull
File "/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth", line 67, in resolve_repository_name
File "/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth", line 46, in expand_registry_url
docker.errors.DockerException: HTTPS endpoint unresponsive and insecure mode isn't enabled.
我在互联网上看到它,它与不安全的存储库有关。
只有当我编辑文件时它才有效
/etc/default/docker
内容
DOCKER_OPTS="-r=true --insecure-registry d-myrepo:5000 ${DOCKER_OPTS}"
重启docker服务,手动拉取镜像。即
docker pull d-myrepo:5000/mycompany/my_service:latest
有没有办法避免这个错误?并且配置 运行ning 顺利?也许我在 docker-composer.yml
文件中遗漏了一个选项?
感谢您的反馈,实现此目的的最佳方法是按以下方式设置 vagrant 配置
config.vm.provision :docker
config.vm.provision :docker_compose
config.vm.provision "shell", path: "provision.sh", privileged: false
而 shell 脚本 provision.sh
将包含以下相关行。
sudo echo "DOCKER_OPTS=\"-r=true --insecure-registry my_repo:5000 ${DOCKER_OPTS}\"" | sudo tee /etc/default/docker
sudo service docker restart
sudo /usr/local/bin/docker-compose -f /vagrant/docker-compose.yml up -d --allow-insecure-ssl
我已设置 docker-compose 从自定义存储库中提取图像。
这是 yaml 文件的样子
my_service:
image: d-myrepo:5000/mycompany/my_service:latest
ports:
- "8079:8079"
现在如果我 运行 vagrant up,它会出错
==> 默认值:文件“/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth”,第 46 行,在 expand_registry_url ==> 默认值:docker.errors ==> 默认值:. ==> 默认值:DockerException ==>默认值:: ==> 默认值:未启用 HTTPS 端点无响应和不安全模式。 以下 SSH 命令以非零退出状态响应。 Vagrant 认为这意味着命令失败!
/usr/local/bin/docker-compose -f "/vagrant/docker-compose.yml" up -d
Stdout from the command:
Stderr from the command:
stdin: is not a tty
Creating vagrant_y2y_1...
Pulling image d-myrepo:5000/mycompany/my_service:latest...
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command
File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 464, in up
File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 208, in up
File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 214, in recreate_containers
File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 197, in create_container
File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 710, in pull
File "/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth", line 67, in resolve_repository_name
File "/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth", line 46, in expand_registry_url
docker.errors.DockerException: HTTPS endpoint unresponsive and insecure mode isn't enabled.
我在互联网上看到它,它与不安全的存储库有关。
只有当我编辑文件时它才有效
/etc/default/docker
内容
DOCKER_OPTS="-r=true --insecure-registry d-myrepo:5000 ${DOCKER_OPTS}"
重启docker服务,手动拉取镜像。即
docker pull d-myrepo:5000/mycompany/my_service:latest
有没有办法避免这个错误?并且配置 运行ning 顺利?也许我在 docker-composer.yml
文件中遗漏了一个选项?
感谢您的反馈,实现此目的的最佳方法是按以下方式设置 vagrant 配置
config.vm.provision :docker
config.vm.provision :docker_compose
config.vm.provision "shell", path: "provision.sh", privileged: false
而 shell 脚本 provision.sh
将包含以下相关行。
sudo echo "DOCKER_OPTS=\"-r=true --insecure-registry my_repo:5000 ${DOCKER_OPTS}\"" | sudo tee /etc/default/docker
sudo service docker restart
sudo /usr/local/bin/docker-compose -f /vagrant/docker-compose.yml up -d --allow-insecure-ssl