Category Archives: DevOps

Deploy a local registry container in Docker

Create local registry container in Docker

A docker registry is a stateless, highly scalable application that stores and lets you distribute Docker images. Registries could be local (private) or cloud-based (private or public)

  1. Docker open registry(local registry)
  2. Docker trusted registry
  3. Docker hub (cloud-based registry)

Example to push the image to a local registry container(deploy local registry)

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


sunny@Oracle1:~/Desktop$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
Unable to find image 'registry:2' locally
2: Pulling from library/registry
ef5531b6e74e: Pull complete 
a52704366974: Pull complete 
dda5a8ba6f46: Pull complete 
eb9a2e8a8f76: Pull complete 
25bb6825962e: Pull complete 
Digest: sha256:3f71055ad7c41728e381190fee5c4cf9b8f7725839dcf5c0fe3e5e20dc5db1fa
Status: Downloaded newer image for registry:2
81c1e47d588b5590a1508e9cd94767edc4790a23eb9dea22b9726c7edab2544c

sunny@Oracle1:~/Desktop$ docker ps
CONTAINER ID   IMAGE        COMMAND                  CREATED          STATUS          PORTS                                       NAMES
81c1e47d588b   registry:2   "/entrypoint.sh /etc…"   14 seconds ago   Up 13 seconds   0.0.0.0:5000->5000/tcp, :::5000->5000/tcp   registry

sunny@Oracle1:~/Desktop$ docker images
REPOSITORY             TAG         IMAGE ID       CREATED        SIZE
registry               2           0d153fadf70b   2 weeks ago    24.2MB
image-oracle           latest      fead993590eb   3 weeks ago    15.8GB
ubuntu                 latest      58db3edaf2be   4 weeks ago    77.8MB

sunny@Oracle1:~/Desktop$ docker tag ubuntu localhost:5000/ubuntu:ver2

sunny@Oracle1:~/Desktop$ docker images
REPOSITORY             TAG         IMAGE ID       CREATED        SIZE
registry               2           0d153fadf70b   2 weeks ago    24.2MB
image-oracle           latest      fead993590eb   3 weeks ago    15.8GB
ubuntu                 latest      58db3edaf2be   4 weeks ago    77.8MB
localhost:5000/ubuntu  ver2        58db3edaf2be   4 weeks ago    77.8MB

--- PUSH the image to Local Registry container
sunny@Oracle1:~/Desktop$ docker push localhost:5000/ubuntu:ver2
The push refers to repository [localhost:5000/ubuntu]
c5ff2d88f679: Pushed 
ver2: digest: sha256:e6987feeb4f79e553bf07738ec908fde797c008941dcadf569b993c607a9cc55 size: 529
sunny@Oracle1:~/Desktop$