Building an image

In your home directory, create a FundamentalsOfDocker folder and navigate to it:

$ mkdir ~/FundamentalsOfDocker$ cd ~/FundamentalsOfDocker

In the preceding folder, create a sample1 subfolder and navigate to it:

$ mkdir sample1 && cd sample1

Use your favorite editor to create a file called Dockerfile inside this sample folder with the following content:

FROM centos:7RUN yum install -y wget

Save the file and exit your editor.

Back in the Terminal, we can now build a new container image using the preceding Dockerfile as a manifest or construction plan:

$ docker image build -t my-centos .

Please note that there is a period at the end of the preceding command. This command means that the Docker builder is creating a new image ...

Get Getting Started with Containerization 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.