使用docker-compose运行容器时出错,从dockerhub中的私人仓库中提取图像时出错 [英] Error running containers with docker-compose, error pulling images from my private repo in dockerhub

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

问题描述

我在Docker Hub的私有存储库中推送了3张图像。
在本地,我一直运行3张图像的方式是通过docker-compose up -d,它可以正常工作。

I have 3 images pushed on my private repository in docker hub. Locally, the way I've always run the 3 images is via docker-compose up -d, and it works.

现在,我试图在其他服务器上运行此映像,因此将它们推送到docker hub中的私有存储库中。

Now I'm trying to run this images in a different server so I pushed them in a private repository in docker hub.

因此,为了在新服务器中运行它们,我要做的是:

So in order to run them in the new server this is what I do:

1-我运行使用我的Docker Hub凭据登录Docker

1- I run docker login with my docker hub credentials

WARNING! Your password will be stored unencrypted in /home/user/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

2-我没有错误地手动拉出它们:

2- I pulled them manually with no error:

~$ docker pull user/repo:tag
mongo: Pulling from user/repo
Digest: sha256:9c6a336963e6f680aa9550d502bc777e212f0025d22229fd60cb5826289f84e4
Status: Image is up to date for user/repo:tag

所以我在这里复制了docker-compose.yml:

So I copied there my docker-compose.yml:

版本: 3.1

services:
  engine:
    image: engine
    container_name: engine
    ports:
      - 5000:5000
    volumes:
      - $HOME/data/engine-import:/app/import
    depends_on:
      - mongo

  mongo:
    image: mongo
    container_name: mongo
    ports:
      - 27018:27017
    volumes:
      - $HOME/data/mongo-data:/data/db
      - $HOME/data/mongo-bkp:/data/bkp
    restart: always

-BUT-即使我有图像,当我运行docker-组成-d这就是我得到的:

-BUT- Even though I have the images there, when I run docker-compose up -d this is what I get:

Pulling mongo (mongo:)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

如果我输入 Y,它将尝试拉动而没有成功...

and if I enter "Y" it tries to pull with no success...

Pulling mongo (mongo:)...
ERROR: pull access denied for mongo, repository does not exist or may require 'docker login'

我之前确实登录过。

不胜感激

更新:添加--verbose标志,这是整个输出:

UPDATE: adding a --verbose flag this is the whole output:

compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['/home/myuser/.docker/config.json', '/home/myuser/.dockercfg']
docker.utils.config.find_config_file: Found file at path: /home/myuser/.docker/config.json
docker.auth.load_config: Found 'auths' section
docker.auth.parse_auth: Found entry (registry='https://index.docker.io/v1/', username='akapit')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/version HTTP/1.1" 200 557
compose.cli.command.get_client: docker-compose version 1.21.2, build a133471
docker-py version: 3.3.0
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.0.1t  3 May 2016
compose.cli.command.get_client: Docker base_url: http+docker://localhost
compose.cli.command.get_client: Docker version: Platform={'Name': ''}, Components=[{'Name': 'Engine', 'Version': '18.06.0-ce', 'Details': {'ApiVersion': '1.38', 'Arch': 'amd64', 'BuildTime': '2018-07-18T19:09:05.000000000+00:00', 'Experimental': 'false', 'GitCommit': '0ffa825', 'GoVersion': 'go1.10.3', 'KernelVersion': '4.15.13-x86_64-linode106', 'MinAPIVersion': '1.12', 'Os': 'linux'}}], Version=18.06.0-ce, ApiVersion=1.38, MinAPIVersion=1.12, GitCommit=0ffa825, GoVersion=go1.10.3, Os=linux, Arch=amd64, KernelVersion=4.15.13-x86_64-linode106, BuildTime=2018-07-18T19:09:05.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('outflink_default')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/networks/outflink_default HTTP/1.1" 200 555
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': True,
 'ConfigFrom': {'Network': ''},
 'ConfigOnly': False,
 'Containers': {},
 'Created': '2018-08-15T12:59:22.828407238Z',
 'Driver': 'bridge',
 'EnableIPv6': False,
 'IPAM': {'Config': [{'Gateway': '172.18.0.1', 'Subnet': '172.18.0.0/16'}],
          'Driver': 'default',
          'Options': None},
...
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/info HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker info -> {'Architecture': 'x86_64',
 'BridgeNfIp6tables': True,
 'BridgeNfIptables': True,
 'CPUSet': True,
 'CPUShares': True,
 'CgroupDriver': 'cgroupfs',
 'ClusterAdvertise': '',
 'ClusterStore': '',
 'ContainerdCommit': {'Expected': 'd64c661f1d51c48782c9cec8fda7604785f93587',
                      'ID': 'd64c661f1d51c48782c9cec8fda7604785f93587'},
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('outflink_default')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/networks/outflink_default HTTP/1.1" 200 555
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': True,
 'ConfigFrom': {'Network': ''},
 'ConfigOnly': False,
 'Containers': {},
 'Created': '2018-08-15T12:59:22.828407238Z',
 'Driver': 'bridge',
 'EnableIPv6': False,
 'IPAM': {'Config': [{'Gateway': '172.18.0.1', 'Subnet': '172.18.0.0/16'}],
          'Driver': 'default',
          'Options': None},
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=mongo', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dmongo%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=mongo', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dmongo%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=engine', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dengine%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=engine', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dengine%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('mongo')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/images/mongo/json HTTP/1.1" 404 82
compose.service.pull: Pulling mongo (mongo:)...
compose.cli.verbose_proxy.proxy_callable: docker pull <- ('mongo', tag='latest', stream=True, platform=None)
docker.auth.get_config_header: Looking for auth config
docker.auth.resolve_authconfig: Looking for auth entry for 'docker.io'
docker.auth.resolve_authconfig: Found 'https://index.docker.io/v1/'
docker.auth.get_config_header: Found auth config
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.25/images/create?tag=latest&fromImage=mongo HTTP/1.1" 404 109
ERROR: compose.cli.main.up: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

Continue with the new image? [yN]y
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('outflink_default')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/networks/outflink_default HTTP/1.1" 200 555
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': True,
 'ConfigFrom': {'Network': ''},
 'ConfigOnly': False,
 'Containers': {},
 'Created': '2018-08-15T12:59:22.828407238Z',
 'Driver': 'bridge',
 'EnableIPv6': False,
 'IPAM': {'Config': [{'Gateway': '172.18.0.1', 'Subnet': '172.18.0.0/16'}],
          'Driver': 'default',
          'Options': None},
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=mongo', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dmongo%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=mongo', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dmongo%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=engine', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dengine%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=outflink', 'com.docker.compose.service=engine', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Doutflink%22%2C+%22com.docker.compose.service%3Dengine%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('mongo')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/images/mongo/json HTTP/1.1" 404 82
compose.service.pull: Pulling mongo (mongo:)...
compose.cli.verbose_proxy.proxy_callable: docker pull <- ('mongo', tag='latest', stream=True, platform=None)
docker.auth.get_config_header: Looking for auth config
docker.auth.resolve_authconfig: Looking for auth entry for 'docker.io'
docker.auth.resolve_authconfig: Found 'https://index.docker.io/v1/'
docker.auth.get_config_header: Found auth config
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.25/images/create?tag=latest&fromImage=mongo HTTP/1.1" 404 109
ERROR: compose.cli.errors.log_api_error: pull access denied for mongo, repository does not exist or may require 'docker login'`

我的docker-compose版本为 docker-c设为1.22.0版,构建f46880fe

My docker-compose version is docker-compose version 1.22.0, build f46880fe

谢谢

推荐答案

问题出在我的docker-compose.yml中。

The problem was in my docker-compose.yml.

image:engine 应该是image:myuser / repository:engine

image: engine should be image: myuser/repository:engine

我必须使用docker hub用户和存储库定义映像名称,我认为用docker pull来拉取它们就足够了

I had to define the image name with its docker hub user and repository, I thought It was enough to pull them with docker pull being that they are already tagged that way.

无论如何,它行得通!

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

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