Create an apache docker image using dockerfile, Docker’s now most widely used container virtualization. It helps us to decrease IT cost and we can run multiple containers in a single Operating System. you can also create apache dockerfile in centos.
We can also create an apache container using the command line and also with images. you can write all the packages that require to create an image and later you can use to create more containers using this image. It will save you time.
Create Apache Docker Image Using Dockerfile:
When you’re going to have a container then you must attach the data volume.
Check Out: Create A Container
I will show you how to create a container of Apache using the Docker file. The recommended way is to create Docker Images that create a directory and keep your files there.
mkdir apache cd /apache vim dockerfile
docker build -t dockerfile .
Check Out: Backup of a Container
The image has been built.
Now you need to create an Apache container using the Centos-Apache image.
docker run -itd --name apachecon -p 147:80 1e1148e4cc2c /bin/bash
Access the container using docker attach 231cac0c66235f
Check Out: Monitor Health of a Container
The next step is to check the website running in a docker container from outside.
That’s it apache dockerfile centos