Intoduction to the Dockerfile

Intoduction to the Dockerfile for beginner

source image :
vim Dockerfile
FROM docker/whalesay:latestRUN apt -y update && apt install -y fortunesCMD /usr/games/fortune -a | cowsay
  • RUN <command> (shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows)
  • RUN ["executable", "param1", "param2"] (exec form)
  • CMD ["executable","param1","param2"] (exec form, this is the preferred form)
  • CMD ["param1","param2"] (as default parameters to ENTRYPOINT)
  • CMD command param1 param2 (shell form)
sudo docker build -t docker-whale .
sudo docker image ls
docker images
sudo docker run docker-whale
run image docker-whale



Cloud DevOps Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store