- 准备第二台机器上传到私服
- Ubuntu 14.04, Debian 7 Wheezy
- Ubuntu 16.04+, Debian 8+, centos 7
- 我们把原来的image删除重新从私服拉取
首先准备两台服务器
其中一台搭建私服
-
首先安装好docker http://liaowo.me/articles/2018/09/10/1536559972112.html
-
安装运行 docker-registry
docker run -d -p 5000:5000 --restart=always --name registry registry
准备第二台机器上传到私服
-
这里我们拿hello-world image示范
docker tag hello-world ip:5000/hello-world
使用
docker tag将hello-world:latest这个镜像标记为ip:5000/hello-world:latest -
push image到私服
docker push ip:5000/hello-world
-
如果显示如下则需要设置下
http: server gave HTTP response to HTTPS client
Ubuntu 14.04, Debian 7 Wheezy
对于使用 `upstart` 的系统而言,编辑 `/etc/default/docker` 文件,在其中的 `DOCKER_OPTS` 中增加如下内容: ``` DOCKER_OPTS="--registry-mirror=https://registry.docker-cn.com --insecure-registries=ip" ``` 重新启动服务。 ``` $ sudo service docker restart ```
Ubuntu 16.04+, Debian 8+, centos 7
对于使用 `systemd` 的系统,请在 `/etc/docker/daemon.json` 中写入如下内容(如果文件不存在请新建该文件)
```
{
"registry-mirror": [
"https://registry.docker-cn.com"
],
"insecure-registries": [
"ip:5000"
]
}
```
> 注意:该文件必须符合 `json` 规范,否则 Docker 将不能启动。
-
再次push image即可
我们把原来的image删除重新从私服拉取
查看私服的image
用 curl 查看仓库中的镜像。
$ curl ip:5000/v2/_catalog
{"repositories":["ubuntu"]}
浏览器访问ip:5000/v2/_catalog也可以
以上所述就是小编给大家介绍的《搭建docker私服》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 为 Go module 搭建私服
- 自己搭建Maven服务器私服
- 搭建 nuget 私服及注意事项
- Mastodon 2.9.2 发布,用它搭建“私服”微博
- Mastodon 2.8.2 发布,用它搭建一个“私服”微博!
- mastodon 2.8.3 发布,用它搭建一个“私服”微博!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Programming Python
Mark Lutz / O'Reilly Media / 2006-8-30 / USD 59.99
Already the industry standard for Python users, "Programming Python" from O'Reilly just got even better. This third edition has been updated to reflect current best practices and the abundance of chan......一起来看看 《Programming Python》 这本书的介绍吧!