Interactively – Lets create a docker image for a website
To create a website we need to have
web server
web design
Lets create a docker container with nginx image
docker run -d --name web1 -p 80:80 nginx
Now download a zip file and extract
mkdir website
cd website/
wget https://templatemo.com/tm-zip-files-2020/templatemo_623_novapay.zip
ls
unzip templatemo_623_novapay.zip
ls
cd templatemo_623_novapay/
We can copy contents of folder from host into container
docker cp . web1:/usr/share/nginx/html/
Now access docker container by using ip of the server
Now lets save the image of this contianer
docker commit web1 novapay
docker image ls
Now remove the continaer docker rm -f web1 and create a new contianer with novapay image
docker run -d --name web2 -p 80:80 novapay
Remove the contiainer
docker rm -f web2
this approach works but requires lot of manual steps for creating image thats where we have docker instruction based image creation which is referred as Dockerfile