How do I set up a private Docker registry?

Linode Staff

I'd like to host my own custom images on a private registry -- how might I go about that?

1 Reply

This is a great question, and its solution is easier than you might think!

Step One: Install Docker

In order to run a registry on a Linode, you'll first need to have Docker installed and configured. If you're unsure of how to do so, I'd recommend taking a look at our guide on Docker microservices.

Step Two: Pull the Docker Registry Container

That's right, Docker Registry is, in and of itself, a Docker image! To pull the container, you can run the following command:

$ docker run -d -p 5000:5000 --restart=always --name registry registry:2

You can verify that you've successfully pulled the image with this command:

$ docker ps

Step Three: Tag your custom image

This will allow for your image to be run by Docker instances down the line:

$ docker tag <your-image-name> <your-registry's-IP-address>:5000/<your-image-name>

Similar to the previous step, you can verify that this worked as intended with $ docker images.

Step Four: Push your image to your registry

This will look very similar to the tag command in the previous step:

$ docker push <your-registry's-IP-address>:5000/<your-image-name>

If you happen to receive an error because your registry responded with an HTTP message as opposed to HTTPS, you can add the following to your /etc/docker/daemon.json file:

{
  "insecure-registries" : ["<your-registry's-IP-address>:5000"]
}

From here, you should be pull your image from your registry. If you happen to notice any additional issues, though, feel free to share them here.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct