0% found this document useful (0 votes)
11 views4 pages

Dockerfile implementation with some hosting

The document outlines the creation of Dockerfiles for hosting three different web applications: a boxer website using Apache, a todo app using Nginx, and a Mario game using Apache. It provides detailed instructions for setting up the Docker environment, including commands for building and running the containers. The document also includes notes on issues encountered and solutions implemented during the setup process.

Uploaded by

banda.aws09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Dockerfile implementation with some hosting

The document outlines the creation of Dockerfiles for hosting three different web applications: a boxer website using Apache, a todo app using Nginx, and a Mario game using Apache. It provides detailed instructions for setting up the Docker environment, including commands for building and running the containers. The document also includes notes on issues encountered and solutions implemented during the setup process.

Uploaded by

banda.aws09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

We are creating docker file for hosting our webserver on container.

We are going to host 3 containers for a boxer website, to do website and Mario game. We are using
apache2 webserver for boxer-app, nginx webserver for todo app and Mario game hosting on apache2.

Note: We have used Ubuntu AMI for this project.

1) Write a docker file(on git-hub repo) with name Dockerfile only as docker recognizes this
name only.
Dockerfile contents for boxerapp.

#we are attaching a base to our docker image


FROM ubuntu:latest
#we are giving naming and filtering keys and values to our image
LABEL DEVOPSENGG="ANUP"

#we are installing few packages in our image


RUN apt update
RUN apt install unzip apache2 -y
RUN rm -rf /var/www/html/index.html

#we are going to apache httpd's deployment location i.e changing directory
WORKDIR /var/www/html/

#we are appending static website logic from remote server


#ADD https://www.free-css.com/assets/files/free-css-templates/download/page296/oxer.zip .
COPY oxer.zip .

#we are running few commands in /var/www/html location


RUN unzip oxer.zip
RUN mv oxer-html/* .

#we are exposing our container to port 80


EXPOSE 80

#we are running a background process for our image


CMD ["apache2ctl" , "-DFOREGROUND"]

Note: we have written COPY oxer.zip instead of ADD boxer-website-url because error was
appearing from the free-css website as it was unable to download it from source.
2) Install and configure docker from Install Docker Engine on Ubuntu | Docker Docs on the
instance.
3) Configuration of git repo on instance and docker build and docker run.
git clone https://github.com/learnerkaran/docker-file-prac.git
cd docker-file-prac/
ls

Note: Here I already had boxer website’s content in my repo.

docker build –t boxer-app .


docker run –d –p 80:80 18cff
Note: Here above 18cff is image id of our boxer-app which we had built here.
docker ps

Now hit IP:port only on your website.

Next page is for nginx to do hosting


1. Dockerfile and its content for to do app hosting.

FROM ubuntu:latest
LABEL SITEHOST="TODO"
RUN apt update
RUN apt install nginx -y
RUN rm -rf /var/www/html/index.html
WORKDIR /var/www/html/
COPY todo6/* .
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

git pull
ls
cd todo6-cont/
ls

docker build -t todoapp .


docker run -d -P 3221

Now hit IP:port/todo6.html only on your website.


I. Dockerfile and its contents for Mario game hosting.

FROM ubuntu:latest
LABEL SITEHOST="MARIO"
RUN apt update
RUN apt install apache2 unzip -y
RUN rm -rf /var/www/html/index.html
WORKDIR /var/www/html/
#ADD https://www.free-css.com/assets/files/free-css-templates/download/page296/oxer.zip .
COPY Mario_Game-main.zip .
RUN unzip Mario_Game-main.zip
RUN mv Mario_Game-main/* .
EXPOSE 80
CMD ["apache2ctl" , "-DFOREGROUND"]

git clone https://github.com/learnerkaran/docker-file-prac.git


cd docker-file-prac/
cd todo6-cont/
cd supermario-game/
ls

docker build -t marioapp .


docker run -d -p 80:80 b79

You might also like