Remove blank lines after code block markers

This commit is contained in:
yeasy
2026-03-21 22:36:09 -07:00
parent 312f8fea42
commit 9ac19d79ee
132 changed files with 0 additions and 1517 deletions

View File

@@ -17,7 +17,6 @@
```bash
$ docker run -d -p 5000:5000 --restart=always --name registry registry
```
这将使用官方的 `registry` 镜像来启动私有仓库默认情况下仓库会被创建在容器的 `/var/lib/registry` 目录下你可以通过 `-v` 参数来将镜像文件存放在本地的指定路径例如下面的例子将上传的镜像放到本地的 `/opt/data/registry` 目录
```bash
@@ -26,7 +25,6 @@ $ docker run -d \
-v /opt/data/registry:/var/lib/registry \
registry
```
### 6.2.2 在私有仓库上传搜索下载镜像
创建好私有仓库之后就可以使用 `docker tag` 来标记一个镜像然后推送它到仓库例如私有仓库地址为 `127.0.0.1:5000`
@@ -38,7 +36,6 @@ $ docker image ls
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu latest ba5877dc9bec 6 weeks ago 192.7 MB
```
使用 `docker tag` `ubuntu:latest` 这个镜像标记为 `127.0.0.1:5000/ubuntu:latest`
格式为 `docker tag IMAGE[:TAG] [REGISTRY_HOST[:REGISTRY_PORT]/]REPOSITORY[:TAG]`
@@ -50,7 +47,6 @@ REPOSITORY TAG IMAGE ID CREATE
ubuntu latest ba5877dc9bec 6 weeks ago 192.7 MB
127.0.0.1:5000/ubuntu:latest latest ba5877dc9bec 6 weeks ago 192.7 MB
```
使用 `docker push` 上传标记的镜像
```bash
@@ -64,14 +60,12 @@ b38367233d37: Pushed
2aebd096e0e2: Pushed
latest: digest: sha256:fe4277621f10b5026266932ddf760f5a756d2facd505a94d2da12f4f52f71f5a size: 1568
```
`curl` 查看仓库中的镜像
```bash
$ curl 127.0.0.1:5000/v2/_catalog
{"repositories":["ubuntu"]}
```
这里可以看到 `{"repositories":["ubuntu"]}`表明镜像已经被成功上传了
先删除已有镜像再尝试从私有仓库中下载这个镜像
@@ -92,7 +86,6 @@ $ docker image ls
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
127.0.0.1:5000/ubuntu:latest latest ba5877dc9bec 6 weeks ago 192.7 MB
```
### 6.2.3 配置非 https 仓库地址
如果你不想使用 `127.0.0.1:5000` 作为仓库地址比如想让本网段的其他主机也能把镜像推送到私有仓库你就得把例如 `192.168.199.100:5000` 这样的内网地址作为私有仓库地址这时你会发现无法成功推送镜像
@@ -117,7 +110,6 @@ REPOSITORY TAG IMAGE ID CREAT
]
}
```
> 注意该文件必须符合 `json` 规范否则 Docker 将不能启动
### 6.2.4 其他