Pushing images to Docker Hub

We can create a customized image that can then be pushed on Docker Hub using tagging. Let's create a simple image with a small terminal-based application. Create a Dockerfile with the following content:

FROM debian:wheezy 
RUN apt-get update && apt-get install -y cowsay fortune 

Go to the directory containing the Dockerfile and execute the following command to build an image:

$ docker build -t test/cowsay-dockerfile . Sending build context to Docker daemon 2.048 kB Sending build context to Docker daemon Step 0 : FROM debian:wheezy wheezy: Pulling from debian 048f0abd8cfb: Pull complete fbe34672ed6a: Pull complete Digest: sha256:50d16f4e4ca7ed24aca211446a2ed1b788ab5e3e3302e7fcc11590039c3ab445 Status: Downloaded newer image ...

Get Troubleshooting 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.