1
0
mirror of https://github.com/distribution/distribution-library-image synced 2024-11-07 05:05:50 +01:00

Add a startup script (docker-entrypoint.sh) and use it as the entrypoint for the

official image container.

This conforms to the official image rules to run the container with a shell
without using the --entrypoint flags.

Supports:

[o] docker run registry sh                        # /bin/sh
[o] docker run -v /a:/b registry /b/config.yml    # /bin/registry serve /b/config.yml
[o] docker run registry                           # /bin/registry serve /etc/docker/config.yml
[o] docker run -ti registry -h                    # /bin/registry -h
[o] docker run <command> [args]                   # /bin/registry <command> [args]

Signed-off-by: Richard Scothern <richard.scothern@docker.com>
This commit is contained in:
Richard Scothern 2016-04-14 10:46:53 -07:00
parent c74e503ff3
commit 578da7e03c
2 changed files with 22 additions and 2 deletions

@ -12,5 +12,7 @@ COPY ./registry/config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
ENTRYPOINT ["/bin/registry"]
CMD ["serve", "/etc/docker/registry/config.yml"]
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

18
docker-entrypoint.sh Executable file

@ -0,0 +1,18 @@
#!/bin/sh
set -e
if [ -f $1 ]; then
set -- /bin/registry serve "$@"
exec "$@"
fi
if [ "$1" = "sh" ]; then
shift
set -- /bin/sh "$@"
exec "$@"
fi
set -- /bin/registry "$@"
exec "$@"