Creating a Dockerfile
A basic Docker element is a file called a Dockerfile, which contains step-by-step instructions for building a Docker image.
To understand how to create a Dockerfile, we'll look at an example that allows us to build a Docker image that contains an Apache web server and a web application.
Let's start by writing a Dockerfile.
Writing a Dockerfile
To write a Dockerfile, we will first create a HyperText Markup Language (HTML) page that will be our web application. So, we'll create a new appdocker
directory and an index.html
page in it, which includes the example code that displays welcome text on a web page, as follows:
<html> <body> <h1>Welcome to my new app</h1> This page is test for my demo Dockerfile.<br /> Enjoy ... </body> </html>
Then, in the same directory, we create a Dockerfile (without...