Cheatsheet

Docker

Cheatsheet for Docker

Table of Contents
  1. Account commands
  2. Basic Commands
    1. Tagging example
  3. Container Commands
  4. Cleaning Up

Account commands

  • docker login - Register or log in to a Docker registry
  • docker logout - Log out from a Docker registry

Basic Commands

  • docker pull - Pull image or repository from a Docker registry
  • docker push - Push an image or repository to a Docker registry
  • docker tag [IMAGE] [NAME:TAG] - Tag a docker image with name and chosen tag
  • docker build [PATH | URL] - Build an image from a Dockerfile located in PATH or URL
  • docker images - List all Docker images
  • docker ps - List all Docker containers

Tagging example

bash
1docker tag <image hash> <dockerhub repo/name>:latest
2docker push <dockerhub repo/name>:latest

Container Commands

  • docker cp [LOCAL PATH] [CONTAINER:DEST_PATH - Copy files from host to Docker container
  • docker cp [CONTAINER:PATH] [LOCAL PATH] - Copy files from Docker container to local path
  • docker attach CONTAINER - Attach local standard input, ouput and error streams to a running Docker container
  • docker run - Run a command in a new Docker container
  • docker start - Start one or more stopped Docker containers
  • docker stop - Stop a running Docker container

Cleaning Up

  • docker rmi - Remove one or more images
  • docker rm - Remove one or more containers
  • docker system prune - Remove unused data
  • docker system prune -a - Remove all unused images

Webmentions

0 Like 0 Comment

You might also like these

Cheatsheet for LunarVim

Read More
Cheatsheet

LunarVim

LunarVim

Cheatsheet for Bash scripting

Read More
Cheatsheet

Bash Scripting

Bash Scripting

Cheatsheet for command line shortcuts

Read More
Cheatsheet

Command Line Shortcuts

Command Line Shortcuts

Cheatsheet for the editor VIM

Read More
Cheatsheet

Vim

Vim