This directory contains a basic example of how can Artipie be used as a Docker registry.
Try this example by running run.sh
script.
Basic configuration my-docker.yaml
:
repo:
type: docker
storage:
type: fs
path: /var/artipie/data
After creating the configuration file below, the configured Docker registry is ready for use.
Before pushing any images let's pull an existing one from Docker Hub:
docker pull ubuntu
Since the Docker registry is going to be located at localhost:8080/my-docker, we tag the pulled image respectively:
docker image tag ubuntu localhost:8080/my-docker/myfirstimage
Afterwards we have to login, since Artipie Docker registry support only authorized users:
docker login --username alice --password qwerty123 localhost:8080
And finally, we are ready to push the pulled image:
docker push localhost:8080/my-docker/myfirstimage
The image can be pulled as well:
# Pull the pushed image from artipie.
docker image rm localhost:8080/my-docker/myfirstimage
docker pull localhost:8080/my-docker/myfirstimage
We may also assign a port for the repository
to access the image by name without using my-docker
prefix.
To do that we add host: 8081
parameter to existing my-docker.yaml
:
repo:
host: 8081
type: docker
storage:
type: fs
path: /var/artipie/data
Now we may pull image localhost:8080/my-docker/myfirstimage
we pushed before as localhost:8081/myfirstimage
:
docker pull localhost:8081/myfirstimage
Docker registry has to be protected by HTTPS and should have no prefix in path.
In order to access this Docker repository it is required to run a reverse proxy such as
nginx or lighttpd to protect Artipie
with HTTPS and add forwarding of requests from my-docker.my-company.com/<path>
to
my-artipie.my-company.com/my-docker/<path>
.
Then to push your Docker image use the following command:
$ docker push my-docker.my-company.com/my-image
To pull the image use the following command:
$ docker pull my-docker.my-company.com/my-image
Try this docker-proxy.yaml
file to host a proxy to registry-1.docker.io
registry:
repo:
type: docker-proxy
remotes:
- url: registry-1.docker.io
username: Aladdin # optional
password: OpenSesame # optional
Artipie will redirect all pull requests to specified registry.
Proxy repository supports caching in local storage.
To enable it and make previously accessed images available when source repository is down
add storage
section to config:
repo:
type: docker-proxy
remotes:
- url: mcr.microsoft.com
cache:
storage:
type: fs
path: /tmp/artipie/data/my-docker-cache
It is possible to push images using docker push
command to proxy storage
and store them locally if storage
is specified as follows:
repo:
type: docker-proxy
remotes:
- url: registry-1.docker.io
- url: mcr.microsoft.com
storage:
type: fs
path: /tmp/artipie/data/my-docker