0

My PC is a Windows 10 PRO with Docker Desktop CE Version 2.0.0.3 (31259) (Engine 18.09.2).

I'm building a docker-compose.yml file which runs Traefik, Portainer, GitLab, Jenkins and Registry containers. Traefik is configured with SSL (self-signed certificate). I've achieved to run the containers in their domains:

When I run these URLs in a browser it returns me certificate error but I access web clients without problems. If I access the URL https://registry.localhost/v2/_catalog from the browser I can read: {"repositories":[]} This is good. I just started my Registry and it's empty.

I generated the self-signed certificate with:

"C:\Program Files\OpenSSL-Win64\bin\openssl.exe" req -x509 -nodes -days 365 -newkey rsa:2048 -keyout traefik.key -out traefik.crt

I attach the configuration files. I omit part of the docker-compose.yml for short.

docker-compose.yml

version: '3.7'

services:
  traefik:
    image: traefik
    container_name: traefik
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - D:\docker-vols\paas\traefik\traefik.toml:/traefik.toml
      - D:\docker-vols\paas\traefik\certs:/certs/
    labels:
      traefik.enable: true
      traefik.frontend.rule: "Host:traefik.localhost"
      traefik.port: 8080
      # Escapar $ con otro $
      traefik.frontend.auth.basic: "root:$$apr1$$3sEZB9aF$$y8ii5P4E8/KAhCiyQoS8I0"
#  portainer:
# ...
#  gitlab:
# ...
#  jenkins:
# ...
  registry:
    image: registry:2
    container_name: registry
    volumes:
      - D:\docker-vols\paas\registry\registry:/var/lib/registry
    labels:
      traefik.enable: true
      traefik.frontend.rule: "Host:registry.localhost"
      traefik.port: 5000

traefik.toml

defaultEntryPoints = ["http", "https"]
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]
    [[entryPoints.https.tls.certificates]]
      certFile = "/certs/traefik.crt"
      keyFile = "/certs/traefik.key"

[api]

[docker]
  endpoint = "unix:///var/run/docker.sock"
  domain = "docker.localhost"
  watch = true
  exposedbydefault = false

I run it: docker-compose up

My problem comes when I want to push an image to my Registry from the host (my Windows PC) to test that it works perfectly. I follow the next steps:

docker pull hello-world
docker tag hello-world registry.localhost/my-hello-world
docker push registry.localhost/my-hello-world

Then it returns

The push refers to repository [registry.localhost/my-hello-world]
Get https://registry.localhost/v2/: dial tcp: lookup registry.localhost on 192.168.65.1:53: no such host

Where's my mistake? Thank you.


SOLUTION:

I forgot to add to /etc/hosts:

127.0.0.1 registry.localhost
Miguel
  • 536
  • 6
  • 20

0 Answers0