Skip to main content

Docker commands

50 Essential Docker Commands for Developers

50 Essential Docker Commands for Developers

Command Description
docker runCreates and starts a new container from an image.
docker psLists running containers. Use `docker ps -a` for all.
docker stopStops a running container.
docker startStarts a stopped container.
docker restartRestarts a container.
docker killForcefully stops a container. Use with caution.
docker rmRemoves a stopped container.
docker rmiRemoves an image. Remove dependent containers first.
docker imagesLists available images.
docker buildBuilds an image from a Dockerfile.
docker pullDownloads an image from a registry.
docker pushUploads an image to a registry.
docker execExecutes a command inside a container (e.g., `bash`).
docker logsDisplays container logs.
docker cpCopies files between container and host.
docker inspectDisplays detailed information about a container/image.
docker portShows port mappings for a container.
docker statsDisplays container resource usage statistics.
docker compose upStarts services defined in a `docker-compose.yml` file.
docker compose downStops services defined in a `docker-compose.yml` file.
docker compose psLists containers created by Docker Compose.
docker compose execExecutes a command in a running Compose container.
docker compose logsViews logs from Compose services.
docker compose buildBuilds or rebuilds services defined in `docker-compose.yml`.
docker network createCreates a Docker network.
docker network connectConnects a container to a network.
docker network disconnectDisconnects a container from a network.
docker network lsLists Docker networks.
docker volume createCreates a Docker volume.
docker volume lsLists Docker volumes.
docker volume rmRemoves a Docker volume.
docker volume inspectDisplays information about a volume.
docker loginLogs in to a Docker registry.
docker logoutLogs out from a Docker registry.
docker searchSearches for images on Docker Hub.
docker infoDisplays system-wide Docker information.
docker versionDisplays Docker version information.
docker attachAttaches to a running container.
docker commitCreates a new image from a container's changes.
docker diffShows changes to files in a container's filesystem.
docker eventsGets real time events from the docker server.
docker historyShows the history of a Docker image.
docker importImports a tarball as a Docker image.
docker loadLoads an image from a tar archive.
docker saveSaves one or more images to a tar archive.
docker tagCreates a tag for an image.
docker waitBlocks until a container stops, then prints its exit code.
docker updateUpdates configuration of one or more containers.
docker system pruneRemoves unused data.
docker context lsLists the Docker contexts.
docker context useSets the current Docker context.

Comments

Popular posts from this blog

Hexagonal Architecture (Ports & Adapters Pattern)

Hexagonal Architecture , also known as the Ports and Adapters pattern, is a software design pattern that aims to create a decoupled and maintainable application by separating the core business logic from external concerns (like databases, APIs, and UIs). Structure of Hexagonal Architecture A typical Hexagonal Architecture has three main layers: 1️⃣ Core Domain (Application Logic) This contains the business rules and domain models. It is completely independent of external technologies . Example: If you’re building a banking system , this part would include logic for transactions, withdrawals, and deposits . 2️⃣ Ports (Interfaces) These are interfaces that define how the core interacts with external components. Two types of ports: Inbound Ports (driven by external inputs like APIs, UI, or events) Outbound Ports (used to interact with external services like databases, messaging systems, etc.) 3️⃣ Adapters (Implementation of Ports) These are concrete implementations of the ports, re...

Recursion & Choice

Understanding Recursion and Choice Diagrams with Examples Understanding Recursion and Choice Diagrams with Examples Recursion is a powerful concept in programming where a function calls itself to solve smaller instances of the same problem. It's often used in solving complex problems that can be broken down into simpler subproblems. In this blog post, we'll explore the basics of recursion, understand choice diagrams, and see examples to illustrate these concepts. What is Recursion? Recursion occurs when a function calls itself directly or indirectly to solve a problem. A recursive function must have a base case to terminate the recursive calls and prevent infinite recursion. Here's a simple example of a recursive function to calculate the factorial of a number: public class RecursionExample { public static void main(String[] args) { int number = 5; int result = factorial(...

Frameworks

  Communication Frameworks: BLUF:  Google's culture strongly emphasizes efficiency and directness, so getting to the "bottom line up front" is very common. SCQA:  Used in presenting proposals, making recommendations, and structuring project plans. PAS : Used in selling ideas and influencing others. BAB : Used in selling ideas and influencing others. Sparklines : Used in presentation to influence others. STAR:  Widely used in Google's interview process and performance evaluations. Problem-Solving/Decision-Making Frameworks: 5 Whys:  A fundamental technique for root cause analysis, and Google is known for its emphasis on data-driven decision-making, which often involves digging into the root causes of problems. Systems Thinking:  Given the complexity of Google's systems, a systems thinking approach is essential. The Four Questions : Used in post-mortem to review an incident. Human factors : Used in post-mortem to avoid the blame culture. Time Management/Prior...