Study Notes
  • Introduction
  • Architecture & System Design
    • Messaging Systems
    • RPC Frameworks
    • Scalable Web Application Architecture
    • Parallel vs Concurrent
    • Concurrency
    • Load Balancing - Nginx
    • REST API
    • WebSockets
    • Streaming
    • Serialization
  • Programming Language
    • JavaScript & Node.js
      • Node.js Promises
      • Node.js Async Flow Control
      • Node.js Profiling
    • Java
    • Erlang
    • Python
    • Golang
      • Go Runtime Scheduler
  • Software Engineering
    • Design Patterns
    • Unit Testing
    • Legacy Code
    • Agile & Scrum
  • Database
    • NoSQL
    • SQL
  • DevOps & Tools
    • Version Control - Git
    • Shell - zsh, bash
    • Docker
    • Linux Package Management - YUM
    • Linux Command Line Tools
  • Security
    • OWASP Security
  • AI, ML, DL, CV, NLP
    • Deep Learning
Powered by GitBook
On this page
  • Best practices for Dockerfiles
  • Commonly Used Docker Commands

Was this helpful?

  1. DevOps & Tools

Docker

PreviousShell - zsh, bashNextLinux Package Management - YUM

Last updated 5 years ago

Was this helpful?

Best practices for Dockerfiles

Dockerfile defines a container

Then build an image from a Dockerfile

$ docker build

Commonly Used Docker Commands

// List all containers
$ docker ps -a 

// List stopped containers
$ docker ps -f "status=exited"

// Remove all stopped containers
$ docker rm $(docker ps -a -q)

// List Docker images
$ docker images

REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
test1                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
test2                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)

// Remove a docker images by id
$ docker rmi fd484f19954f

// Create a new image from a container’s changes
$ docker commit a5f2a390c452 ssm-env

// Launch several sessions connected to the same container 
// from multiple host terminals.
$ docker exec -it <container> bash
Best practices for writing Dockerfiles
Dockerfile reference