搭建docker私服

栏目: 编程工具 · 发布时间: 7年前

  • 准备第二台机器上传到私服
  • Ubuntu 14.04, Debian 7 Wheezy
  • Ubuntu 16.04+, Debian 8+, centos 7
  • 我们把原来的image删除重新从私服拉取

首先准备两台服务器

其中一台搭建私服

搭建 <a href='https://www.codercto.com/topics/20577.html'>docker</a> 私服

准备第二台机器上传到私服

搭建docker私服

  • 这里我们拿hello-world image示范

    docker tag hello-world  ip:5000/hello-world

    使用 docker taghello-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即可

    搭建docker私服

我们把原来的image删除重新从私服拉取

搭建docker私服

搭建docker私服

搭建docker私服

查看私服的image

curl 查看仓库中的镜像。

$ curl ip:5000/v2/_catalog
{"repositories":["ubuntu"]}

浏览器访问ip:5000/v2/_catalog也可以

搭建docker私服


以上所述就是小编给大家介绍的《搭建docker私服》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Data Structures and Algorithms

Data Structures and Algorithms

Alfred V. Aho、Jeffrey D. Ullman、John E. Hopcroft / Addison Wesley / 1983-1-11 / USD 74.20

The authors' treatment of data structures in Data Structures and Algorithms is unified by an informal notion of "abstract data types," allowing readers to compare different implementations of the same......一起来看看 《Data Structures and Algorithms》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具