DEV Community

Anthony Gilbert
Anthony Gilbert

Posted on

Setting up apache with Docker for frontend development.

In this part, we are going to be setting up a plain Docker container(just HTML).

To get started, the first thing we want to do is install Docker. You can do this by downloading it from the Docker website.

To get started we will create an empty directory by typing mkdir <project-name> and then cd into that directory.

Once we have cd' into our new directory, we will create a new Docker file by typing touch Dockerfile into the terminal. Once the file is created you can open it with your favorite editor and paste the following code inside of it.

image

Once you have done this, we need to run touch index.html and then copy/paste the following code into our newly created html file.
image

Now that we have configured a basic Dockerfile, we need to build the image by typing docker build -t <project-name> . into the terminal afterwards you should see your new image in the output.

Once the command has finished, we should now have a new image. You can double check this by typing docker images into the terminal.

Now to run our new image we need to type the following: docker run -d -p 80:80 <project name>. You will know that the image has been built successfully when it return a unique identifier.

Congratulations! 🥳
You have successfully created a Docker container with just an HTML file!! From here you can add your own libraries.

To visit the newly created UI, go to http://localhost/index.html

Top comments (0)