mirror of
https://github.com/distribution/distribution-library-image
synced 2024-11-07 05:05:50 +01:00
Add library image for registry
This is based on swarm-library-image. Unfortunately, the registry binary needs to be checked in - otherwise "docker build" wouldn't work without preparation, as is required of official images. The binary checked in here is from distribution's current master branch (4cc4d440f6afc7b27c2220993d01a4e2889d87c0). It will need to be updated to the release version after each release. Rather than creating a container from scratch, this library image is based on the ubuntu container, because registry is a dynamically linked binary. Because we're using the ubuntu container as a base, manual installation of ca-certificates.crt isn't necessary. If we end up switching to a scratch container, this will need to be re-added. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
d6ee50a2de
commit
c017c8583d
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
# Build a minimal distribution container
|
||||
|
||||
FROM ubuntu:14.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ca-certificates librados2 apache2-utils && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./registry/registry /bin/registry
|
||||
COPY ./registry/config-example.yml /etc/docker/registry/config.yml
|
||||
|
||||
VOLUME ["/var/lib/registry"]
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT ["/bin/registry"]
|
||||
CMD ["/etc/docker/registry/config.yml"]
|
11
registry/config-example.yml
Normal file
11
registry/config-example.yml
Normal file
@ -0,0 +1,11 @@
|
||||
version: 0.1
|
||||
log:
|
||||
fields:
|
||||
service: registry
|
||||
storage:
|
||||
cache:
|
||||
layerinfo: inmemory
|
||||
filesystem:
|
||||
rootdirectory: /var/lib/registry
|
||||
http:
|
||||
addr: :5000
|
BIN
registry/registry
Executable file
BIN
registry/registry
Executable file
Binary file not shown.
34
update.sh
Executable file
34
update.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
echo "Usage: ./update.sh <docker/distribution tag or branch>"
|
||||
exit
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
|
||||
# cd to the current directory so the script can be run from anywhere.
|
||||
cd `dirname $0`
|
||||
|
||||
echo "Fetching and building distribution $VERSION..."
|
||||
|
||||
# Create a temporary directory.
|
||||
TEMP=`mktemp -d /$TMPDIR/distribution.XXXXXX`
|
||||
|
||||
git clone -b $VERSION https://github.com/docker/distribution.git $TEMP
|
||||
docker build -t distribution-builder $TEMP
|
||||
|
||||
# Create a dummy distribution-build container so we can run a cp against it.
|
||||
ID=$(docker create distribution-builder)
|
||||
|
||||
# Update the local binary and config.
|
||||
docker cp $ID:/go/bin/registry registry
|
||||
docker cp $ID:/go/src/github.com/docker/distribution/cmd/registry/config-example.yml registry
|
||||
|
||||
# Cleanup.
|
||||
docker rm -f $ID
|
||||
docker rmi distribution-builder
|
||||
|
||||
echo "Done."
|
Loading…
Reference in New Issue
Block a user