O'Reilly logo

DevOps for Web Development by Mitesh Soni

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Docker image from Dockerfile

Our next step is to create a sample image file. We can build a Docker image using a Dockerfile. It provides step-by-step instructions to building images.

Let's try with a simple CentOS image:

  1. The Dockerfile contains the following two lines:
            FROM centos 
            MAINTAINER mitesh <mitesh.soxxxxxx@xxxxxxxx.com>
    
  2. Go to the same directory in the terminal and use docker build .to build an image:
                [root@localhost Desktop]# docker build .
                Sending build context to Docker daemon 681.6 MB
                Sending build context to Docker daemon 
                Step 0 : FROM centos
                 ---> 2a332da70fd1
                Step 1 : MAINTAINER mitesh < mitesh.soxxxxxx@xxxxxxxx.com >
                 ---> Running in 305e8da05500 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required