Dockerfile implementation with some hosting
Dockerfile implementation with some hosting
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.
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 going to apache httpd's deployment location i.e changing directory
WORKDIR /var/www/html/
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
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
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"]