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:
- 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 withDockerfile
- Using the
- Push this created image to the Docker Hub.
- 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 ...
Get Learning Docker now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.