Error running containers with docker-compose, error pulling images from my private repo in dockerhub

magnoz picture magnoz · Aug 16, 2018 · Viewed 20.1k times · Source

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.

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- 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- 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

So I copied there my docker-compose.yml:

version: '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- 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.

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'

And I did login right before.

I'd appreciate any help

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'`

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

Thanks

Answer

magnoz picture magnoz · Aug 16, 2018

The problem was in my docker-compose.yml.

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

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.

Anyways, It works!