DevOps Classroom notes 04/Sep/2026

two Ways to create docker images

  1. interactively : manually run container and then save as an image

  2. Dockerfile (instructions-based): build image based instructions (automatically create image)

  3. interactively method:

  • first need run container
docker run -d --name web1 -p 80:80 nginx

download sample website

mkdir website
cd website
wget https://www.tooplate.com/download/2168_sweet_bakery
cp 2168_sweet_bakery 2168_sweet_bakery.zip
sudo apt install unzip
unzip 2168_sweet_bakery.zip
docker cp . web1:/usr/share/nginx/html/

out put

Successfully copied 817kB (transferred 828kB) to web1:/usr/share/nginx/html/

verify server by access port 80

http://20.46.241.140/

svae the container


docker commit web1 2168_sweet_bakery:1.2.0
docker images

docker run -d --name sweet_bakery -p 8080:80 2168_sweet_bakery:latest

  1. Dockerfile referance
  • to create image we need follow docker instructions
  1. FROM – base image (os image or required configuation image ) Ex: ubuntu , oracle-linux, alpine (lite weight linux kernal os), java, python, dotnet, windows-dotnet …etc

  2. WORKDIR – set working directory in docker image

  3. COPY – copy local files to my docker image

  4. ADD – downloads files or packages

  5. RUN – Execute commands during build ex:

alpine - apk add git
ubuntu - apt-get install git -y
oracle-linux - yum install git -y
windows - winget install git -y 
  1. EXPOSE – application ports
  2. CMD – command to run when container start ex: java -jar spring.jar
  3. entrypoint – run first command when container start

task:

  1. create docker image using interactively method
  2. https://www.tooplate.com/free-templates free templates

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%