How we can create own private repository like docker hub to pull and push own image
[root@ip-172-31-93-16 ~]# docker container run -d -p 5000:5000 --name simple_registry registry
[root@ip-172-31-93-16 ~]# docker container run -d -p 5000:5000 --name simple_registry registry
[root@ip-172-31-93-16 ~]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2f2ccf162441 registry "/entrypoint.sh /etc…" 22 seconds ago Up 22 seconds 0.0.0.0:5000->5000/tcp simple_registry
[root@ip-172-31-93-16 ~]# docker pull redis
[root@ip-172-31-93-16 ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
redis latest 598a6f110d01 7 days ago 118MB
registry latest f32a97de94e1 4 months ago 25.8MB
[root@ip-172-31-93-16 ~]# docker image tag redis 127.0.0.1:5000/redis
[root@ip-172-31-93-16 ~]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2f2ccf162441 registry "/entrypoint.sh /etc…" 12 minutes ago Up 12 minutes 0.0.0.0:5000->5000/tcp simple_registry
[root@ip-172-31-93-16 ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
127.0.0.1:5000/redis latest 598a6f110d01 7 days ago 118MB
redis latest 598a6f110d01 7 days ago 118MB
registry latest f32a97de94e1 4 months ago 25.8MB
[root@ip-172-31-93-16 ~]# docker image push 127.0.0.1:5000/redis
The push refers to repository [127.0.0.1:5000/redis]
ecfdefa27746: Pushed
178539e30c1b: Pushed
866b8e9e04ba: Pushed
0cd777ef23ac: Pushed
ec2fceb1c8e2: Pushed
d8a33133e477: Pushed
latest: digest: sha256:9815a0d456dbbef05a5fd5efe4406db003d32a2f91de40f01b62457562e1d7f6 size: 1572
you can verify on below location on local system the redis image will be there
http://127.0.0.1:5000/v2/_catalog
Now we are going to delete redis image from system then going to pull from my own repository
[root@ip-172-31-93-16 ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
127.0.0.1:5000/redis latest 598a6f110d01 7 days ago 118MB
redis latest 598a6f110d01 7 days ago 118MB
registry latest f32a97de94e1 4 months ago 25.8MB
[root@ip-172-31-93-16 ~]# docker image rm redis
Untagged: redis:latest
Untagged: redis@sha256:8888f6cd2509062a377e903e17777b4a6d59c92769f6807f034fa345da9eebcf
[root@ip-172-31-93-16 ~]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2f2ccf162441 registry "/entrypoint.sh /etc…" 21 minutes ago Up 21 minutes 0.0.0.0:5000->5000/tcp simple_registry
[root@ip-172-31-93-16 ~]# docker image pull 127.0.0.1:5000/redis
Using default tag: latest
latest: Pulling from redis
Digest: sha256:9815a0d456dbbef05a5fd5efe4406db003d32a2f91de40f01b62457562e1d7f6
Status: Image is up to date for 127.0.0.1:5000/redis:latest
No comments:
Post a Comment