Publishing microservices to the Docker Hub

The Docker Hub is a central repository to store all Docker images. The Docker Hub allows you to create either a public or private repository to store these Docker images. The steps to publish microservices to the Docker Hub are described next.

Let's follow these steps to set up and run a local registry:

  1. Create an account on the Docker Hub at  https://hub.docker.com/.
  2. Create a repository (private or public) for the Docker images, as shown in the following screenshot:

As you can see in the preceding screenshot, we have created three repositories named dineshonjava/account, dineshonjava/customer, and dineshonjava/doj. Of the three, one repository is private and the other two are public.

  1. Log in to the Docker cloud using the Docker login command:
  1. Tag your Docker image using the Docker tag:
  1. Push your image to the Docker Hub using docker push:
  1. Check that the image you just pushed appears in the Docker cloud at https://hub.docker.com/r/dineshonjava/account/tags/:

As you can see in the preceding screenshot, I have pushed two tags of the Account microservice.

We have seen in this section how to set up and use the Docker Hub to publish the Docker images. We can globally access the Docker images by this convenient mechanism. We have published three Docker images to the Docker Hub from the local machine. Let's look at how to download and run these images to the AWS EC2 instances. But first, we have to install Docker on the AWS EC2 instance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset