Giter Site home page Giter Site logo

docker-stafwag-registry's Introduction

docker-stafwag-registry

Dockerfile to run docker-registry inside a docker container. The registry daemon will run as the librarian user. The uid/gid is mapped to 50000. The image is based on Debian.

Installation

clone the git repo

$ git clone https://github.com/stafwag/docker-stafwag-registry.git
$ cd docker-stafwag-registry

deb package or build from source

2 docker files are included:

  • Dockerfile:

    The default dockerfile will use the debian docker-registry package.

  • Dockerfile_from_src:

    Will compile the docker register from source.

    https://github.com/distribution/distribution

    You can set the git release version in the Dockerfile with

    ENV DOCKER_DISTRIBUTION_VERSION="v2.7.1"

To compile the docker registry from source, you can use the -f Dockerfile_from_src argument.

$ docker build -f Dockerfile_from_src -t stafwag/registry .

Update the configuration

$ vi etc/docker/registry/config.yml

The htpasswd authentication is enabled in the configuration. You can mount the passwd file as a volume.

Build the image

The command below builds the image image with the default BASE_IMAGE debian:bullseye.

$ docker build -t stafwag/registry . 

To use a different BASE_IMAGE, you can use the --build-arg BASE_IMAGE=your_base_image.

$ docker build --build-arg BASE_IMAGE=stafwag/debian:bullseye -t stafwag/registry .

Volume and passwd file

Create a directory for the docker registry.

$ sudo mkdir -p /home/volumes/docker/registry
$ sudo chown 50000:50000 /home/volumes/docker/registry

Create a htpasswd file

Create htpasswd file.

-B set the hash to brcypt. -c creates a new file.

$ htpasswd -B -c passwd ikke
New password: 
Re-type new password: 
Adding password for user ikke

Update the permissions.

$ sudo chown root:50000 passwd
$ sudo chmod 0640 passwd
$ ls -l passwd
-rw-r----- 1 root 50000 66 Jun  1 09:39 passwd
$ 

Run

Run the docker command:

docker run -d --rm --name myregistry -p 5000:5000 -v /path/to/passwd:/etc/docker/registry/passwd -v /home/volumes/docker/registry:/var/lib/docker-registry stafwag/registry:latest

Have fun

docker-stafwag-registry's People

Contributors

stafwag avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.