Book Image

Learning Docker

By : Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah
Book Image

Learning Docker

By: Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah

Overview of this book

Table of Contents (18 chapters)
Learning Docker
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Pushing images to the Docker Hub


Here, we will create a Docker image on the local machine, and push this image to the Docker Hub. You need to perform the following steps in this section:

  1. Create a Docker image on the local machine by doing one of the following:

    • Using the docker commit sub command

    • Using the docker commit sub command with Dockerfile

  2. Push this created image to the Docker Hub.

  3. Delete the image from the Docker Hub.

We will use the Ubuntu base image, run the container, add a new directory and a new file, and then create a new image. In Chapter 3, Building Images, we have seen the creation of the Docker image using Dockerfile. You may refer to this to check for details of the Dockerfile syntax.

We will run the container with the name containerforhub from the base ubuntu image, as shown in the following terminal code:

$ sudo docker run -i --name="containerforhub" -t ubuntu /bin/bash
root@e3bb4b138daf:/#

Next, we'll create a new directory and file in the containerforhub container. We will...