Book Image

Beginning DevOps with Docker

By : Joseph Muli
5 (1)
Book Image

Beginning DevOps with Docker

5 (1)
By: Joseph Muli

Overview of this book

Making sure that your application runs across different systems as intended is quickly becoming a standard development requirement. With Docker, you can ensure that what you build will behave the way you expect it to, regardless of where it's deployed. By guiding you through Docker from start to finish (from installation, to the Docker Registry, all the way through to working with Docker Swarms), we’ll equip you with the skills you need to migrate your workflow to Docker with complete confidence.
Table of Contents (7 chapters)

Deploying a Docker Image to Docker Hub


Every time we run docker build, the image created is locally available. Normally, the Dockerfile is hosted together with the code base; therefore, on a new machine, one would need to use docker build to create the Docker image.

With Docker Hub, any developer has the opportunity to have a Docker image hosted to be pulled into any machine running Docker. This does two things:

  • Eliminates the repetitive task of running docker build

  • Adds an additional way of sharing your application which is simple to set up compared to sharing a link of your app's code base and README detailing the setup process

docker login is the command to run to connect to Docker Hub via the CLI. You need to have an account in hub.docker.com and enter the username and password through the terminal.

docker push <docker-hub-username/image-name[:tag]> is the command to send the image to the registry, Docker Hub:

A simple search of your image on hub.docker.com will give the output to your Docker image.

In a new machine, a simple docker pull <docker-hub-username/your-image-name> command will produce a copy of your image locally.