下载并启动registrylinux
$ docker pull registry
$ docker run --name my_registry -d -p 5000:5000 -v /var/lib/registry:/var/lib/registry registrynginx
从官方仓库下载nginx并push到私有仓库中docker
$ docker pull nginx
$ docker tag nginx localhost:5000/mynginx
$ docker push localhost:5000/mynginxjson
push报错curl
The push refers to repository [localhost:5000/nginx]
Get https://localhost:5000/v2/: http: server gave HTTP response to HTTPS clienturl
解决方法rest
$ echo '{ "insecure-registries":["localhost:5000"] }' > /etc/docker/daemon.json
$ service docker restartserver
早期docker版本(1.10及以前)不支持insecure-registries,须要改成it
# vi /etc/sysconfig/docker
OPTIONS='--selinux-enabled --insecure-registry=localhost:5000 --log-driver=journald'cli
再push便可
$ curl http://localhost:5000/v2/_catalog{"repositories":["mynginx"]}