In this config we will show how to run a local Docker registry on a local network. We assume that the host which will run Docker registry has the Docker already installed and can be accessed either via hostname or IP address. Alternatively, you can run your local Docker registry on a local system using 127.0.0.1
or localhost
In our scenario we will run docker on host: linuxconfig.docker.local
. Let’s start by running a Docker registry container on linuxconfig.docker.local
host:
# docker run -d -p 5000:5000 registry e6f9480e94ea30a4a400f499b9e28dfac87ccd3ccb59627e78fe784249248127
Next from a client host, use docker command to obtain an IMAGE-ID of the docker image you wish to push to your local repository:
# docker images
Take a note of the IMAGE ID eg. 41b730702607
. Now that we have an IMAGE ID of the docker image we would like to upload to our own local docker registry we can use docker tag
command to tag this image for an upload:
# docker tag 41b730702607 linuxconfig.docker.local:5000/debian:8
Once we have tagged our image we can use docker push
command to upload it our local docker registry:
# docker push linuxconfig.docker.local:5000/debian:8 The push refers to a repository [linuxconfig.docker.local:5000/debian] (len: 1) Sending image list Pushing repository linuxconfig.docker.local:5000/debian (1 tags) 3cb35ae859e7: Image successfully pushed 41b730702607: Image successfully pushed Pushing tag for rev [41b730702607] on {http://linuxconfig.docker.local:5000/v1/repositories/debian/tags/8}
Lastly, search your local Docker registry to confirm a correct upload:
# docker search linuxconfig.docker.local:5000/debian NAME DESCRIPTION STARS OFFICIAL AUTOMATED library/debian