
Docker Registry 是 Docker 生态系统中用于存储、分发 Docker 镜像的服务。它允许用户将本地构建的镜像推送到远程服务器,也可以从远程服务器拉取镜像到本地运行。Docker Registry 支持用户自行搭建私有的镜像存储库(私有仓库),以便对镜像进行管理和分发。
Docker Registry 的主要功能包括:
Docker Registry 的两种主要实现包括:
Docker Registry 的工作流程大致如下:
Docker Registry 是 Docker 镜像管理的核心组件,无论是使用官方的 Docker Hub 还是搭建私有仓库,都提供了灵活且高效的镜像存储和分发方式。
registry是一个镜像,也需要拉取



# 命令:
docker run -d -p 5000:5000 -v /zzyyuse/myregistry/:/tmp/registry --privileged=true registry
-d : 后台运行容器并返回容器D,也即启动守护式容器(后台运行)
-p:指定瑞口映射,小写p 端口映射 -p hostPort:containerPort

根据下面步骤,给ubuntu增加ifconfig命令并生成新的镜像
1. 从Hub上下载Ubuntu镜像到本地并成功运行
docker pull ubuntu
2. 原始的Ubuntu镜像是不带着ifconfig命令的
root@b6f15583f362:/# ifconfig
bash: ifconfig: command not found
3. 外网连通的情况下,安装ifconfig命令并测试通过
1. apt-get update # 此命令用于更新您的系统上的软件包索引。
2. aptget install net-tools # 此命令用于安装 net-tools 软件包,它包含了一组基本的网络诊断工具,如 ifconfig、netstat、route 等。
测试:
root@b6f15583f362:/# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.3 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:ac:11:00:03 txqueuelen 0 (Ethernet)
RX packets 4061 bytes 26654020 (26.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3151 bytes 225239 (225.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
4. 安装完成后,commit我们自己的新镜像
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
93c18a15dd73 ubuntu "bash" 40 seconds ago Up 40 seconds upbeat_bartik
1f847f79aadb registry "/entrypoint.sh /etc…" 12 minutes ago Up 12 minutes 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp charming_mclean
[root@localhost ~]# docker commit -m='+net_tools-ifconfig' -a='zyan' 93c18a15dd73 zyan/hgubuntu:1.2
sha256:aeb2e37a9b2e723689baa06267a291695eeeb35952ef68e484bb5e3d524e6d75
5. 启动我们的新镜像并和原来的对比
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
zyan/hgubuntu 1.2 aeb2e37a9b2e 16 seconds ago 78.1MB
crpi-yy9yj7syn08stogn.cn-shanghai.personal.cr.aliyuncs.com/zhenh/zyan 1.1 ca7abefb7af7 17 hours ago 191MB
ubuntu latest 59ab366372d5 2 weeks ago 78.1MB
registry latest 75ef5b734af4 13 months ago 25.4MB
redis 6.0.8 16ecd2772934 4 years ago 104MB
[root@localhost ~]#




镜像仓库的地址部署在虚拟机上,所以这里写你虚拟机的ip地址,结果发现啥也没有
这里的:5000,因为我们启动时,传了一个-p参数,映射我们主机的5000端口
curl -XGET http://你的虚拟机ip:5000/v2/_catalog # 通过ifconfig查看

curl 是一个功能强大的命令行工具,用于传输数据,支持多种协议,包括 HTTP、HTTPS、FTP、SCP、SFTP 等。它常用于从命令行发送请求到服务器,下载文件,测试网络服务等。
以下是 curl 命令的一些常用用法:
发送 HTTP GET 请求:
curl http://example.com
这会向 http://example.com 发送一个 GET 请求,并显示响应内容。
发送 HTTPS GET 请求:
curl https://example.com
这会向 https://example.com 发送一个 GET 请求,并显示响应内容。
下载文件:
curl -O http://example.com/file.zip
使用 -O 参数,curl 会将下载的文件保存为 URL 中指定的文件名。
发送 HTTP POST 请求:
curl -d "param1=value1¶m2=value2" http://example.com/resource
使用 -d 参数发送 POST 请求,并传递数据。
发送带有 HTTP 头的请求:
curl -H "X-My-Header: 123" http://example.com
使用 -H 参数添加自定义 HTTP 头。
使用用户名和密码进行认证:
curl -u username:password http://example.com
使用 -u 参数提供基本认证信息。
上传文件:
curl -F "file=@localfile.txt" http://example.com/upload
使用 -F 参数上传文件。
使用代理:
curl -x http://proxyserver:port http://example.com
使用 -x 参数通过代理服务器发送请求。
查看请求的详细信息:
curl -v http://example.com
使用 -v 参数显示请求的详细过程,包括请求头和响应头。
保存响应头:
curl -D headers.txt http://example.com
使用 -D 参数保存响应头到文件。
curl 命令非常灵活,可以通过各种参数来定制请求。这些只是一些基本用法,curl 还有很多其他功能和选项,可以通过查看 curl 的手册页(man curl)或在线文档来获取更多信息。

docker tag 镜像:Tag Host:Port/Repository:Tag


上述理由:docker默认不允许htp方式推送镜像,通过配置选项来取消这个限制。====>修改完后如果不生效,建议重启docker
[root@localhost docker]# systemctl daemon-reload # 激活配置文件
[root@localhost docker]# systemctl restart docker # 重启docker 每次修改配置 一定要重启



docker pull 172.21.47.251:5000/zyan/hgubuntu:1.2
