🐥
The Tech Toolbox
Visit My Website!LinkedIn Profile
  • ✍️Introduction
  • ✍️Laptop Setup Guide
  • ✍️Quotes
  • Interview Preparation
    • 🔥Topics To Cover
    • 🔥System Design
    • 🔥Google Interview
      • Data Structures
      • Algorithms
      • System Design
      • Programming Concepts
      • Behavioral
    • 🔥Documents
  • Question Answers
    • ⭐Question Set 1
    • ⭐Question Set 2
    • ⭐Question Set 3
    • ⭐Microservice Architecture
    • ⭐Company-wise
      • Publicis Sapient
        • Core Java Section
        • Solutions & Tools
        • Microservices
        • Mix Questions
      • Mastercard
      • Finicity
  • Notes
    • 🎯Java Fundamentals
      • Time & Space Complexity
      • Design Patterns
      • Collections
      • Java 8 Features
      • JVM Internals
      • Generics
      • Multithreading
    • 🎯Spring Fundamentals
      • Spring Boot
      • Spring AOP
      • Spring Cloud
      • Spring Security
      • Spring Batch
    • 🎯Database
      • Oracle SQL
        • Aggregate Functions
      • MongoDB
        • Commands
        • Aggregate Query
      • Distributed Transaction
    • 🎯Apache Kafka
      • Kafka with Spring Boot
      • Partitions
    • 🎯Redis
    • 🎯Mockito
    • 🎯Docker
      • Commands
    • 🎯Kubernetes
      • Commands
    • 🎯Prometheus
    • 🎯Build Tools
      • Gradle
      • Apache Maven
    • 🎯Architecture
      • API and Integration Strategy
  • ⚓Developer Reference
    • ❄️GCP
    • ❄️Linux
  • Structured Learning Plan
    • 🍉Java Multithreading
    • 🍉Data Structures
    • 🍉Spring AOP
    • 🍉Transaction Management
    • 🍉MongoDB
    • 🍉Design Patterns
    • 🍉System Design
Powered by GitBook
On this page

Was this helpful?

  1. Notes
  2. Docker

Commands

Container Management

  1. List running containers: docker ps

  2. List all containers (running and stopped): docker ps -a

  3. Start a container: docker start [CONTAINER_NAME/CONTAINER_ID]

  4. Stop a container: docker stop [CONTAINER_NAME/CONTAINER_ID]

  5. Restart a container: docker restart [CONTAINER_NAME/CONTAINER_ID]

  6. Remove a container: docker rm [CONTAINER_NAME/CONTAINER_ID]

  7. Pause a container: docker pause [CONTAINER_NAME/CONTAINER_ID]

  8. Unpause a container: docker unpause [CONTAINER_NAME/CONTAINER_ID]

  9. Inspect a container: docker inspect [CONTAINER_NAME/CONTAINER_ID]

Image Management

  1. List local Docker images: docker images

  2. Download a Docker image: docker pull [IMAGE_NAME]

  3. Create a Docker image from a Dockerfile: docker build -t [IMAGE_NAME] [DOCKERFILE_PATH]

  4. Remove a Docker image: docker rmi [IMAGE_NAME/IMAGE_ID]

  5. Tag a Docker image: docker tag [IMAGE_NAME/IMAGE_ID] [REPOSITORY_NAME]:[TAG]

  6. Push a Docker image to a repository: docker push [REPOSITORY_NAME]:[TAG]

  7. Pull a Docker image from a repository: docker pull [REPOSITORY_NAME]:[TAG]

Networking

  1. List Docker networks: docker network ls

  2. Create a Docker network: docker network create [NETWORK_NAME]

  3. Connect a container to a network: docker network connect [NETWORK_NAME] [CONTAINER_NAME/CONTAINER_ID]

  4. Disconnect a container from a network: docker network disconnect [NETWORK_NAME] [CONTAINER_NAME/CONTAINER_ID]

Volume Management

  1. List Docker volumes: docker volume ls

  2. Create a Docker volume: docker volume create [VOLUME_NAME]

  3. Remove a Docker volume: docker volume rm [VOLUME_NAME]

  4. Attach a volume to a container: docker run -v [VOLUME_NAME]:[CONTAINER_PATH] [IMAGE_NAME]

  5. Inspect a volume: docker volume inspect [VOLUME_NAME]

Miscellaneous

  1. Open a shell inside a running container: docker exec -it [CONTAINER_NAME/CONTAINER_ID] sh

  2. View logs of a running container: docker logs -f [CONTAINER_NAME/CONTAINER_ID]

PreviousDockerNextKubernetes

Last updated 2 years ago

Was this helpful?

🎯