Skip to content

Techeons

Imagine | Explore | Innovate

Menu
  • Home
Menu

Cheat Sheet: Essential Docker Commands

Posted on September 14, 2024

Docker is an open-source platform that enables developers to build, ship, and run applications in containers. Containers are lightweight, standalone, and executable packages that include everything an application needs to run, such as code, libraries, and dependencies.

Key Features:

  • Containerization: Package applications and their dependencies into a single container.
  • Lightweight: Containers are much lighter than virtual machines.
  • Portable: Containers run consistently across different environments.
  • Isolated: Containers run in isolation, ensuring application security.

Benefits:

  • Faster Deployment: Quickly deploy applications without worrying about dependencies.
  • Efficient Resource Usage: Optimize resource usage with containerization.
  • Improved Collaboration: Ensure consistency across development, testing, and production environments.

Essential Docker Commands

Get the list of active docker containers:

docker ps -a

Get the list of all docker containers:

docker ps

Log into the docker container:

docker exec -it <container-id> /bin/bash

Stop the docker container:

docker stop <container-id>

Remove the docker container:

docker rm <container-id>

Remove the docker image:

docker rmi <docker-image-id>

Check the logs of the docker container:

docker logs <container-id>

Get continuous log output of the docker container:

docker logs -f <container-id>
OR
docker logs --follow <container-id>

Tail last 100 lines of logs of the docker container:

docker logs --tail 100 <container-id>

Share on Social Media
x facebook pinterest linkedin tumblr reddit emailwhatsapptelegrammastodon

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Nginx: How to increase timeout for Nginx
  • Cheat Sheet: Essential Git Commands
  • Setting a default shell in Linux
  • Setting up Composer on Linux
  • Switch easily between Python versions on a Mac using pyenv

Tags

ai alerting aws b2 backblaze certificate cheatsheet cloud commands data-science datalake devops dns docker dremio git gitlab infra jenkins kubernetes linux metabase minikube minio monitoring mount mysql nginx nodejs notebooks openssh php python scala secrets spark ssh ssl ubuntu ufw usb web dev tools windows xampp zeppelin

©2026 Techeons | Design: Newspaperly WordPress Theme