Docker registry
This is a study note based on YouTube docker tutorial: https://www.youtube.com/watch?v=fqMOX6JJhGo&t=4048s
docker run nginx
In docker "run" command, you can specify the image name like "nginx" above. However this is not a full name. The full name should be like below:
There are some other registries except the Docker Hub registry like Google registry "gcr.io".
Private Registry
If you do not want to publish your registry, you can use private registry instead.
In order to use private registry, firstly you need to login the private registry using below command:
docker login private-registry.io
Input the username and password in the console. Then you can run a container from the images in private registry.
docker run private-registry.io/apps/internal-app
If you didn't login the private registry, it will tell you "the image cannot be found". So remember to login before push/pull to/from the private registry.
When you use AWS or GCP, they will provide a private registry to you automatically. If you want to deploy a private registry on your own, you can do so as well.
Registry in docker is actually a docker image exposing itself on port 5000. So you can use "run" command to expose the registry like below:
docker run -d -p 5000:5000 --name registry registry:2
Use "image tag" command to tag the image with the private registry url in it.
docker image tag my-image localhost:5000/my-image
Then use "push/pull" command to push/pull the image.
docker push localhost:5000/my-image
docker pull localhost:5000/my-image
Reference: https://www.youtube.com/watch?v=fqMOX6JJhGo&t=4048s
Comments
Post a Comment