

We will see how to create a Dockerfile image to create an Apache httpd Docker Container and Docker image. Since Apache is most widely used web server, Let us go with that. Let us make some plan on what image we are going to create. There are more instructions and elements you can use in the Dockerfile but these are basics and enough for us to create the image The Requirement/ The Plan the Container would run as long as the Default Command is running.ĪDD or COPY The files you want to copy into the container from your host. Every Container must have a Default Command. For example if you are building Apache HTTP server image you can EXPOSE port 80ĬMD The Default Command of the container which gets created using this image. RUN – Commands to Run to make the image( the future container) in the way you wantĮXPOSE Do you want your image or application in the image to expose any port to the external world or at least to the host. you can either use a minimal OS image like CentOS, Alpine or you can create your own from the scratch by mentioning SCRATCH as a value to this. MAINTAINER – Who Crate and manage this container imageįROM – What is the base image, we are going to use to host our container. These are a list of information that we must put in the Dockerfile to create an image.

What information should the Docker file have? you need to create a file named Dockerfile and specify some information in it. To know more about what is container refer this link How to Create a Docker Image?Ĭreating a Docker image is an easy job. The Running instances of the image are called as a container. a template using which you can create N number of containers The Image is a file more like a manifest, where you define what are the packages and software and configurations should be available when you create a container from the image. Image Credits to SwapnIl Dwivedi – UnSplash Image vs Container Docker run Image – Create and Start a Container from our Image.List the images and make sure the image is created.The Final Directory Structure of Our WorkSpace.Create a Sample HTML file for our website.Create a Virtual Host file for our website.Defining a Plan – Create a Ubuntu Apache2 HTTPD container.How to Create a Docker Image – A Quick command overview of Dockerfile.These are the list of steps we are going to perform as part of this post. Docker run image – Run the Image and create a container from it.how to list the available docker images?.The final Directory Structure of our working directory.Create a sample index.html file for our website.
