Description
Description
I have set up a private registry and secured it according to the recipe with an nginx reverse proxy. nginx listens on port 5000 using SSL.
docker pull myregistry:5000/foo:latest
from a remote machine to that registry works fine.
However, that same command on myregistry
itself results in docker trying to access the registry (through nginx) via HTTP, not HTTPS.
Since nginx listens using SSL, it returns an error ("The plain HTTP request was sent to HTTPS port").
According to the Docker documentation, local registries are automatically considered as insecure.
In my case, I want the local registry also to be considered as secure, so that docker pull myregistry:5000/foo:latest
works on the same machine.
There is only an option to mark remote registries as insecure, but not to mark a specific registry as secure.
Obviously, I cannot use a different port to listen for plain HTTP, since that would change the image name. I also did not find a way to make nginx accept HTTP traffic on the same port based on IP address.
Steps to reproduce the issue:
- Setup a local registry on machine
myregistry
, secure it with HTTPS - On the machine
myregistry
, executedocker pull myregistry:5000/foo:latest
Describe the results you received:
Docker connects to the registry using HTTP. Since the registry (proxy) is listening on that port using HTTPS, the connection fails with "The plain HTTP request was sent to HTTPS port".
Describe the results you expected:
Docker can connect to the registry locally using HTTPS.
Additional information you deem important (e.g. issue happens only occasionally):
docker info
shows Insecure Registries: 127.0.0.0/8
although this is not explicitly configured.
The systemd service is configured like this:
ExecStart=/usr/bin/dockerd -H fd:// --tlsverify --tlscacert=/root/ca.pem --tlscert=/root/docker-daemon-cert.pem --tlskey=/root/docker-daemon-key.pem -H 0.0.0.0:2376 --containerd=/run/containerd/containerd.sock
The file /etc/docker/daemon.json
does not exist.
Possible solutions I can think of:
- Docker can try both protocols before failing.
- Add a daemon configuration, similar to
insecure-registries
.
Output of docker version
:
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:45:33 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:42 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.7.1-docker)
scan: Docker Scan (Docker Inc., v0.12.0)
Server:
Containers: 15
Running: 4
Paused: 0
Stopped: 11
Images: 17
Server Version: 20.10.12
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
NodeID: 9csirf32qkrsou039rxx5wen5
Is Manager: true
ClusterID: leux8gq2yb2ya4lhpqyuso1vj
Managers: 1
Nodes: 1
Default Address Pool: 10.0.0.0/8
SubnetSize: 24
Data Path Port: 4789
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 10
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 192.168.1.215
Manager Addresses:
192.168.1.215:2377
Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
Default Runtime: runc
Init Binary: docker-init
containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc version: v1.0.2-0-g52b36a2
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-100-generic
Operating System: Ubuntu 20.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.58GiB
Name: ecsvms024
ID: BBDP:7KMF:M2N6:MGGZ:ENGP:SEME:6I6E:4LAU:5APK:5LQU:RYB7:TWAJ
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support