DevOps Classroom notes 27/May/2026

Docker lifecycle

Common docker commands

  • A container is running and you want to see the logs
docker logs <contaner-id or name>
docker logs <contaner-id or name> -f
  • Docker logs shows only stdout and stderr
  • I want to delete all containers in my system
docker rm -f $(docker ps -a -q)
  • I want to delete all images in my system
docker rmi $(docker image ls -q)
  • You want to clean the images, volumes which are not being used
docker system prune -a
  • You have a container running and for some reason you want to copy a file into it
docker cp <file> <container-name-or-id>:<path>
docker cp 1.txt test1:/
  • You can copy the files from container into local system
docker cp <container-name-or-id>:<path> <file>
  • Inspect commands
docker image inspect <id>
docker container inspect <id>

How are images built and organized

  • Docker image is collection of read-only image layers and these layers are created during building images.
  • Try to create minimal layers
RUN apt update \
    && apt install tree &&\
    apt install mysql-client
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

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%%