我尝试在CentOS7服务器上部署一个不安全的Docker Registry:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
我像这样配置了docker:
# /etc/docker/daemon.json
{
"insecure-registries":["registry.mydomain.com:5000"]
}
有了这个,docker info
给了我:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 2
Server Version: 1.12.4
Storage Driver: devicemapper
Pool Name: docker-253:2-650870-pool
Pool Blocksize: 65.54 kB
Base Device Size: 10.74 GB
Backing Filesystem: xfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 69.86 MB
Data Space Total: 107.4 GB
Data Space Available: 50.4 GB
Metadata Space Used: 708.6 kB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.147 GB
Thin Pool Minimum Free Space: 10.74 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Deferred Deletion Enabled: false
Deferred Deleted Device Count: 0
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.135-RHEL7 (2016-09-28)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: null host bridge overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 3.10.0-327.36.3.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 489.1 MiB
Name: ASB-Registry
ID: KNQD:2AVN:EG5H:VV7U:US7G:SJ2D:G2FY:UAZK:N2NY:FQAA:CQJV:N2IS
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Insecure Registries:
registry.mydomain.com:5000
127.0.0.0/8
所以:
Insecure Registries:
registry.mydomain.com:5000
127.0.0.0/8
显示正确。
但是,当我尝试将容器推送到该注册表时:
docker push registry.mydomain.com:5000/my_image
我得到以下日志:
The push refers to a repository [registry.mydomain.com:5000/my_image]
Get https://registry.mydomain.com:5000/v1/_ping: http: server gave HTTP response to HTTPS client
有什么想法吗?