如何设置dockerregistry中的图像存储path?

我是新来的docker,我想configuration我的本地dockerregistry。 所以我使用这个命令:

docker run -d -p 5000:5000 -e REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/opt/scs/v11/docker_registry --restart=always --name registry registry 

然后,我使用该命令将图像推送到registry:

 docker pull ubuntu&docker tag ubuntu localhost:5000/batman/ubuntu docker push localhost:5000/batman/ubuntu 

我认为它会将图像存储在/ opt / scs / v11 / docker_registry中,但是在这个文件path中我找不到任何东西。 我想知道我的推送图像在哪里? 如果我想将图像存储在特殊文件path中,该怎么做?

您可以尝试环境variablesSTORAGE_PATH ,并将容器registrypath映射到主机(或任何其他可用的目录)上的/tmp/registry

 docker run -d -p 5000:5000 -e STORAGE_PATH=/registry -v /tmp/registry:/registry registry 

这在我的centos服务器上工作:

 [dude@localhost etc]$ ls -la /tmp/registry/ total 8 drwxrwxr-x. 4 dude dude 38 Jul 16 12:24 . drwxrwxrwt. 13 root root 4096 Jul 16 12:28 .. drwxr-xr-x. 16 root root 4096 Jul 16 12:25 images drwxr-xr-x. 3 root root 20 Jul 16 12:24 repositories [dude@localhost etc]$ 

从这里采取

从这里 。

从docker.io中提取registry容器

docker pull registry

然后启动registry服务器

docker run -d -p 5000:5000 -v /docker_repo:/opt/scs/v11/docker_registry registry

停止docker服务器

service docker stop

启动Docker与我们的本地registry(即我们的Docker服务器IP是192.168.109.9)

docker -d –insecure-registry 192.168.109.9:5000 &

从Docker集线器中提取图像

docker pull ubuntu

为我们的本地使用标记图像

docker tag ubuntu 192.168.109.2:5000/ubuntu

看到你的图片

docker images

将图像推送到我们的本地registry

docker push 192.168.109.9:5000/ubuntu

现在,我们可以从本地registry中提取图像

docker pull 192.168.109.9:5000/ubuntu