Procedure:
- First we create docker file to build Apache Web Server in Ubuntu. Docker file is like text file without having any extension
- create index.html file under /DockerDir directory
<!DOCTYPE HTML>
<html>
<body>
<h1> Server Techno Lab</h1>
<h2> https://servertecholab.blogspot.com/</h2>
</body>
</html>
</div>
- Create Docker file for Webserver and copy index.html to docker image and run that URL on port 80
FROM centos:latest MAINTAINER NewstarCorporation RUN yum -y install httpd COPY index.html /var/www/html/ CMD [“/usr/sbin/httpd”, “-D”, “FOREGROUND”] EXPOSE 80
- FROM = container image name : tag
- MAINTAINER = Tag of Image
- RUN = If you want to Run any command in container
- COPY = To copy files
- CMD = Run command using bash
- EXPOSE = Expose port number for service
- Run Docker Build command to build docker file
- You can find your docker image using docker images command
# docker run –d –p 80:80 mywebserver
-d = Docker container deteched and runninin background
-p = Map Port number with container port apache will run on port 80
- Finally you can browse server IP Address and default page of apache
No comments:
Post a Comment