Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help for customize registry 2.0 #1082

Closed
jerrykwchan opened this issue Oct 8, 2015 · 6 comments
Closed

Need help for customize registry 2.0 #1082

jerrykwchan opened this issue Oct 8, 2015 · 6 comments

Comments

@jerrykwchan
Copy link

Hi,

I'm new to docker. I don't know if it is right place to get help for this kind of problem.

I want to run a private registry with bind-mount volume that maps to a local directory. When I finish with the registry, I would like to remove the registry and the local directory of the bind-mount volume. I found that the command "docker rm -v " does not remove the bind-mount volume directory. And the bind-mount volume created is owned by "root". As a non-root user, I have no right remove this directory.

I tried to start by registry with "-u" option but still the bind-mount volume directory still owned by root. Is there anyway to run docker registry 2.X with bind-mount volume owned by non-root? Or is there anyway to remove the bind-mount volume directory without root right?

I see someone suggested to customized registry to run as non-root user. I only able to find a sample for registry version 1.X and I'm not able to push any image to the customized registry. Can anyone show me a sample Dockerfile that customize registry version 2.X?

Here is my Dockerfile:
FROM registry:2
MAINTAINER abc@def.com

docker-archive/docker-registry#892

ENV GUNICORN_OPTS ["--preload"]

RUN adduser --system jerryc
&& addgroup docker
&& chown -R jerryc:docker /var/lib/registry

USER jerryc

CMD ["/etc/docker/registry/config.yml"]

thanks,
Jerry

@taxilian
Copy link

taxilian commented Nov 3, 2015

I've never found a need to build a custom Dockerfile.

docker run -d -p 5000:5000 \
       -v /data/ssd/config/certs:/certs \
       -v /data/gradecam/registry:/var/lib/registry \
       -e REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry \
       -e REGISTRY_STORAGE_REDIRECT_DISABLE=true \
       -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/combined.crt \
       -e REGISTRY_HTTP_TLS_KEY=/certs/STAR_zzt_net.key \
       --restart=always --name=registry registry:2

the STAR_zzt_net.key file is my SSL certificate pem file for the domain I have it on.

@jerrykwchan
Copy link
Author

Hi Taxilian,

Thanks for your reply. What I want to achieve is to make the ownership of the bind mounted volume in host server NOT root. I hope customize the registry allow me to set the ownership. Does anyone have idea how to do it?

thanks,
Jerry

@taxilian
Copy link

taxilian commented Nov 4, 2015

Have you tried just passing -u other_user when doing docker run? (I haven't tried this, but I don't know of any reason that registry would care what user it runs as)

@jerrykwchan
Copy link
Author

I tried but the directory of the bind mount volume in host server still owned by root.

@taxilian
Copy link

taxilian commented Nov 4, 2015

Personally I just map that to a directory on the host filesystem and then chown it myself. I haven't tested this with this image.

What are the log messages when you try to push with your customized image?

@milosgajdos
Copy link
Member

This is more of a question for moby/moby. Besides this issue is ancient. Closing. Feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants