# Docker私有仓库

## 私有仓库搭建与配置&#x20;

（1）拉取私有仓库镜像（此步省略）&#x20;

```
docker pull registry
```

&#x20;（2）启动私有仓库容器

```
 docker run -di --name=registry -p 5000:5000 registry
```

（3）打开浏览器 输入地址<http://192.168.40.111:5000/v2/\\_catalog看到> {"repositories":\[]} 表示私有仓库 搭建成功并且内容为空

（4）修改daemon.json

```
vi /etc/docker/daemon.json
```

添加以下内容，保存退出。

```
{"insecure-registries":["192.168.184.141:5000"]}
```

此步用于让 docker信任私有仓库地址&#x20;

（5）重启docker 服务

```
systemctl restart docker
```

## 镜像上传至私有仓库

（1）标记此镜像为私有仓库的镜像&#x20;

```
docker tag jdk1.8 192.168.40.111:5000/jdk1.8 
```

（2）再次启动私服容器

```
 docker start registry
```

&#x20;（3）上传标记的镜像&#x20;

```
docker push 192.168.40.111:5000/jdk1.8
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docker.shujuwajue.com/docker-de-shi-yong/docker-si-you-cang-ku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
