I have a docker image tagged as me/my-image
, and I have a private repo on the dockerhub named me-private
.
When I push my me/my-image
Ref: dock.docker.com
This topic provides basic information about deploying and configuring a registry
Before you can deploy a registry, you need to install Docker on the host.
Use a command like the following to start the registry container:
start_registry.sh
#!/bin/bash
docker run -d \
-p 5000:5000 \
--restart=always \
--name registry \
-v /data/registry:/var/lib/registry \
registry:2
Pull the ubuntu:16.04
image from Docker Hub.
$ docker pull ubuntu:16.04
Tag the image as localhost:5000/my-ubuntu
. This creates an additional tag for the existing image. When the first part of the tag is a hostname and port, Docker interprets this as the location of a registry, when pushing.
$ docker tag ubuntu:16.04 localhost:5000/my-ubuntu
Push the image to the local registry running at localhost:5000
:
$ docker push localhost:5000/my-ubuntu
Remove the locally-cached images. This does not remove the localhost:5000/my-ubuntu
image from your registry.
$ docker image remove ubuntu:16.04
$ docker image remove localhost:5000/my-ubuntu
Pull the localhost:5000/my-ubuntu
image from your local registry.
$ docker pull localhost:5000/my-ubuntu
According to docs.docker.com, this is very insecure and is not recommended.
Edit the daemon.json
file, whose default location is /etc/docker/daemon.json
on Linux or C:\ProgramData\docker\config\daemon.json
on Windows Server. If you use Docker for Mac
or Docker for Windows
, click Docker icon -> Preferences -> Daemon
, add in the insecure registry
.
If the daemon.json
file does not exist, create it. Assuming there are no other settings in the file, it should have the following contents:
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
With insecure registries enabled, Docker goes through the following steps:
Restart Docker for the changes to take effect.