0

I want to create a docker registry on my server using this docker-compose.yaml file :

version: '3'
services:
  registry:
    restart: always
    image: registry:2
    ports:
      - 5000:5000

    volumes:
      - /home/ubuntu/registry/volumes/data:/var/lib/registry
      - /home/ubuntu/registry/volumes/certs:/certs
      - /home/ubuntu/registry/volumes/auth:/auth
    environment:
      REGISTRY_HTTP_TLS_CERTIFICATE: /home/ubuntu/registry/certs/domain.crt
      REGISTRY_HTTP_TLS_KEY: /home/ubuntu/registry/certs/domain.key
      REGISTRY_AUTH: htpasswd
      REGISTRY_AUTH_HTPASSWD_PATH: /home/ubuntu/registry/auth/htpasswd
      REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm


I am running ''' docker-compose up ''' but this error occurs.

registry_1  | time="2019-08-03T21:17:38.938127498Z" level=fatal msg="open /home/ubuntu/registry/certs/domain.crt: no such file or directory"

I am sure those files exist, do you have any idea?

  • They exist on the host, not in the container. – tkausl Aug 03 '19 at 21:29
  • I know, but I think this container should read them from the host, right? – Muhammad Azhdari Aug 03 '19 at 21:31
  • 1
    If you `docker-compose run registry sh` and poke around, you should see directories `/certs` and `/auth` with the content from the host, but they will not be the host-specific path names. You should change the environment variables to match the paths inside the container. – David Maze Aug 03 '19 at 21:46

1 Answers1

0
volumes:
  - /home/ubuntu/registry/volumes/certs:/certs

Here you are saying to use the HOST path /home/ubuntu/registry/volumes/certs and make it available as /certs inside the CONTAINER. So perhaps you want to change the path on the container side to match the host path, or change the environment variables to reflect the actual container paths.

Also note that you have used /home/ubuntu/registry/volumes/certs in one location and /home/ubuntu/registry/certs (without "volumes") in another, which I assume might need to be fixed up as well.