How to Push a Container Image to a Docker Repository?
In this article we will look into how you can push a container image to a Docker Repo. We’re going to use Docker Hub as a container registry, that we’re going to push our Docker image to.
Follow the below steps to push container Image to Docker repository:
Step 1: The first thing you need to do is make sure that you’ve signed up for Docker account. You can easily come to hub.docker.com, enter a Docker ID, your email address and a password. That’s all you need to do. This Docker account is completely free and you don’t have to pay a single dime for it. You want to make sure that you sign in. This will take you to your dashboard. As you can see here, we haven’t pushed any containers to my register yet:
Step 2: Now, let’s go ahead and take care of that right now. First, we’ll start off with typing the below command. Now, here our credentials are already authenticated, but if yours aren’t, this will ask you to enter your Docker ID and password that you would’ve created when you signed up for Docker Hub account.
Step 3: The next thing we are going to need to do is, select an image that we want to push. So, we are going to type the below command:
We would use a awesomeapp image that we created earlier for this article.
Step 4: So we will use the below command with the tag of the current image
docker push awesomeapp/firstimage
Now, what it’s doing is, taking that image that’s on our local machine and pushing it out into the Docker Hub. If we head back over to our Docker Hub, when we refresh the page, we can now see that image that we just pushed available here in our registry.
At this point we have successfully pushed our docker image to docker repo.