← All docs

Private Docker Registries

Run a registry on an exe.dev VM

By default, the new command assumes that the image you give it is stored in a public Docker repository. As an alternative, you can run a Docker registry on exe.dev, and use that registry to store other images for your VMs.

First, create a VM:

$ssh exe.dev new --name private-registry-test

Then, run the a Docker container that runs the Docker registry on it:

$ssh private-registry-test.exe.xyz docker run -d --name registry -p 8000:5000 registry:2

Then, on the registry machine (or elsewhere), build the image:

$ cat > Dockerfile <<EOF
FROM alpine:latest
RUN echo exe.dev > /hello.txt
EOF

$ docker build -t localhost:8000/my-image:v1
$ docker push localhost:8000/my-image:v1

Finally, create a new VM, using the VM hostname as the registry host.

$ssh exe.dev new --image private-registry-test.exe.xyz/my-image:v1
Creating oboe-hydra using image my-image:v1...

And observe it working:

$ssh oboe-hydra.exe.xyz cat /hello.txt
built-it

Authenticating to an existing registry

If your image already lives in a private registry (ghcr.io, Docker Hub, GitLab, ECR, ...), pass --registry-auth=USERNAME:PASSWORD:

new --image=ghcr.io/OWNER/IMAGE:TAG \
    --registry-auth=USERNAME:TOKEN

ghcr.io requires a classic Personal Access Token with read:packages.

Docker Hub accepts a personal access token with read scope.