Home > database >  How to docker-compose an image hosted in a Digital Ocean private repo?
How to docker-compose an image hosted in a Digital Ocean private repo?

Time:09-27

I connected doctl to my account and logged into the private registry, validate it's successfully authorized, but when I try to docker-compose up -d an image it says that pull access is denied. What could be the reson ?

> doctl account get
User Email                 Team       Droplet Limit    Email Verified    User UUID                               Status
[email protected]           My Team    25               true              aa11a5d9-1913-4f8d-b427-005fa9e11be6    active

Docker daemon is logged into the registry:

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

Login Succeeded

Connection with the registry is established:

> doctl registry login
Logging Docker in to registry.digitalocean.com

My linux user is part of the docker group:

> groups
sudo docker

Docker images are present locally:

>docker images
REPOSITORY                                          TAG       IMAGE ID       CREATED        SIZE
registry.digitalocean.com/project/strategy          latest    60d4796574fc   26 hours ago   1.96GB
registry.digitalocean.com/project/redis             latest    ee373138aeec   47 hours ago   177MB

But I'm unable to execute containers:

(strategy) admin@ubuntu-s-2vcpu-2gb-fra1:/var/www/strategy$ docker-compose up -d
[ ] Running 0/5
 ⠿ flower Error                                                                                                                                                                                                                                                    1.6s
 ⠿ celery_worker Error                                                                                                                                                                                                                                             1.6s
 ⠿ celery_beat Error                                                                                                                                                                                                                                               1.6s
 ⠿ django Error                                                                                                                                                                                                                                                    1.5s
 ⠿ redis-4 Error                                                                                                                                                                                                                                                   1.5s
Error response from daemon: pull access denied for strategy, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

docker-compose.yml

version: '3.8'

services:
  django:
    build:
      context: .
      dockerfile: ./compose/local/django/Dockerfile
    image: strategy
    command: /start
    volumes:
      - .:/app
    ports:
      - "8004:8004"
    env_file:
      - strategy/.env
    depends_on:
      - redis-4
    networks:
      - mynetwork

  redis-4:
    build:
      context: .
      dockerfile: ./compose/local/redis/Dockerfile
    container_name: redis-4
    image: redis
    expose:
      - "6375"
    networks:
      - mynetwork

  celery_worker:
    image: strategy
    command: /start-celeryworker
    volumes:
      - .:/app:/strategy
    env_file:
      - strategy/.env
    depends_on:
      - redis-4
      - strategy
    networks:
      - mynetwork

  celery_beat:
    image: strategy
    command: /start-celerybeat
    volumes:
      - .:/app:/strategy
    env_file:
      - strategy/.env
    depends_on:
      - redis-4
      - strategy
    networks:
      - mynetwork

  flower:
    image: strategy
    command: /start-flower
    volumes:
      - .:/app:/strategy
    env_file:
      - strategy/.env
    depends_on:
      - redis-4
      - strategy
    networks:
      - mynetwork

networks:
  mynetwork:
    name: mynetwork

CodePudding user response:

The names of the images are not correct:

strategy -> registry.digitalocean.com/project/strategy
redis -> registry.digitalocean.com/project/redis
...

If you don't specify the registry then docker assumes it's Docker Hub.

  • Related