Now it time to share your image across multiple platform and team using a docker registries. A registry is a collection of repositories, and a repository is a collection of images—sort of like a GitHub repository, except the code is already built.
Step 1: Make account on cloud.docker.com
Docker’s public registry is free and pre-configured, but there are many public ones to choose from.
Note that the docker CLI uses Docker’s public registry by default.
Login using docker CLI
docker login
After your are logged in successfully
Step 2: Tag the Image
Tagging image is good way of associating a local image with a repository on a registry.
For e.g. my-repo:my-first-image this puts the image in the my-repo repository and tag it as my-first-image.
docker tag image username/repository:tag
docker tag my-app lamadipen/my-repo:first
View list of images docker image ls
Step 3: Publish your image
sudo docker push lamadipen/my-repo:first
Now you can find your image on Docker Hub
Docker hub screen shot
Step 4: Pull the image and run image from the remote repository any where you want.
docker run -p 4000:80 username/repository:tag
For example docker run -p 4000:80 username/repository:tag
This command pull your image from the repository if image isn't available on local machine and run it on your .
Step 5: Check your container serving you application
You will get response from your application on the browser if you check the link in your browser.
http://localhost:8000/
No comments:
Post a Comment