参考文档:https://ken.io/note/docker-private-image-server-deploy
1. 访问在本地创建docker的registry默认是不需要输入用户名,密码的,公司内网或开发小组内部使用起来很方便,但是直接pull会报错:
$ docker pull 192.168.1.13:5000/alpine:latestError response from daemon: Get "https://192.168.1.13:5000/v2/": http: server gave HTTP response to HTTPS client
其中192.168.1.13:5000是之前配好的本地的registry。
解决的办法是创建/修改配置文件:
$ sudo vim /etc/docker/daemon.json
并保证daemon.json文件中有如下内容:
$ cat /etc/docker/daemon.json {"insecure-registries": ["192.168.1.13:5000"] }
然后重启 docker 服务
$ sudo systemctl stop docker $ sudo systemctl start docker
再次尝试拉取Image,成功
$ docker pull 192.168.1.13:5000/alpine:latest latest: Pulling from alpine c6a83fedfae6: Pull complete Digest: sha256:eddacbc7e24bf8799a4ed3cdcfa50d4b88a323695ad80f317b6629883b2c2a78 Status: Downloaded newer image for 192.168.1.13:5000/alpine:latest 192.168.1.13:5000/alpine:latest$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.1.13:5000/alpine latest 324bc02ae123 4 weeks ago 7.8MB