david.perez
david.perez

Reputation: 7012

Docker pull fails behind Apache

I have a custom Docker registry, accessible through http://localhost:5000

Here is the Apache config:

Listen 443
<VirtualHost *:443>
    ServerName registry.mycompany.com

    SSLEngine on
    SSLCertificateFile    ...
    SSLCertificateKeyFile ...
    SSLCACertificateFile  /etc/pki/tls/certs/thawte.pem

    ProxyPreserveHost On
    ProxyPass         / http://localhost:5000/
    ProxyPassReverse  / http://localhost:5000/
    ProxyRequests     Off
</VirtualHost>

And here how I start the registry:

docker run -d \
    -p 5000:5000 \
    -e REGISTRY_STORAGE_DELETE_ENABLED=true \
    -e REGISTRY_AUTH=htpasswd \
    -e REGISTRY_AUTH_HTPASSWD_REALM="Registro" \
    -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
    --restart=always \
    --name registro \
    registry:2

Everything works ok (docker pull, ...), but docker push fails. After some retrying here is the error message shown:

first path segment in URL cannot contain colon

Related doc can be found here:

Upvotes: 2

Views: 339

Answers (1)

david.perez
david.perez

Reputation: 7012

With docker compose, I use the image jwilder/nginx-proxy:alpine as a proxy, and it works much better

version: "3.7"
services:
  registry:
    image: registry:2
    expose:
    - 5000
    volumes:
    - "./registry.yaml:/etc/docker/registry/config.yml"
    - "./img:/var/lib/registry"
    - "./certs:/certs"
    - "./auth:/auth"
    environment:
      VIRTUAL_HOST: registry.company.com
    restart: always
  gui:
    image: joxit/docker-registry-ui:static
    environment:
      URL: https://registry.company.com
      REGISTRY_TITLE: Company Docker registry
      DELETE_IMAGES: "true"
      VIRTUAL_HOST: gui-registry.company.com
      #HTTPS_METHOD: nohttps
    expose:
    - 80
  proxy:
    image: jwilder/nginx-proxy:alpine
    ports:
      - 80:80
      - 443:443
    volumes:
    - "/var/run/docker.sock:/tmp/docker.sock:ro"
    - "./certs:/etc/nginx/certs"
    - "./registry.conf:/etc/nginx/vhost.d/registro.fccma.com"
    - "./cors.conf:/etc/nginx/vhost.d/registro.fccma.com_location"
    environment:
      DEFAULT_HOST: registro.fccma.com

In this way, I can have the Docker registry and its corresponding GUI in the same host.

Upvotes: 1

Related Questions