Introduction to Docker and Podman

Key Points

Introduction
  • Introduces Docker- a popular tool for software containerization.

  • Introduces Podman- an open-source alternative with several advantages.

  • Podman is a drop-in replacement for Docker. Replace podman by docker in the commands and you are good to go.

Pulling Images
  • Pull images with podman pull <image-id>

  • List all images on the computer and other information with podman images

  • Image tags distinguish releases or version and are appended to the image name with a colon

Running Containers
  • Run containers with podman run <image-id>

  • Monitor containers with podman ps

  • Exit interactive sessions using the exit command

  • Restart stopped containers with podman start

File I/O with Containers
  • Copy files with podman cp

  • Mount volumes with podman run -v <path on host>:<path in container> <image>

Coffee break
  • Breaks are helpful in the service of learning

Writing Dockerfiles and Building Images
  • Dockerfiles are written as text file commands to the container engine

  • Images are built with podman build

  • Images can have multiple tags associated to them

  • Images can use COPY to copy files into them during build

Removal of Containers and Images
  • Remove containers with podman rm <CONTAINER NAME>

  • Remove images with podman rmi <IMAGE ID>

  • Perform faster cleanup with podman container prune, podman image prune, and podman system prune

Using CMD and ENTRYPOINT in Dockerfiles
  • CMD provide defaults for an executing container

  • CMD can provide options for ENTRYPOINT

  • ENTRYPOINT allows you to configure commands that will always run for an executing container

Bonus Episode: Building and deploying a Docker container to Github Packages
  • Python packages can be installed in Docker images along with ubuntu packages.

  • It is possible to publish and share Docker images over github packages.