How to set image stored path in docker registry?

10,512

Could you try the environment variable STORAGE_PATH and map the containers registry path to /tmp/registry on your host (or any other available directory).

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

That worked on my centos server:

[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]$ 

Taken from here

Share:
10,512
v11
Author by

v11

It is not easy to meet each other in such a big world.

Updated on June 28, 2022

Comments

  • v11
    v11 almost 2 years

    I'm new to docker, and I want to config my local docker registry. So I use the command:

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

    Then,I use the command to push the image to registry:

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

    I think it will store the image in /opt/scs/v11/docker_registry,But I can't find anything in this file path. I want to know where are my pushing image? How should I do if I want to store image in special file path?