Docker Cheat Sheet

by | Apr 14, 2020

Stop / Start Docker Service in Linux


> systemctl stop docker

> systemctl start docker

Commit Docker Container


> docker commit <container_name>

> start

 

Save Docker Image to Tar File


> docker save -o image.tar <sha256_image_id>

Import Docker Image


> docker load --input image.tar

Start Docker Container


> docker start <container_name>

 

Stop Docker Container


> docker stop <container_name>

 

Stop All Containers


> docker stop $(docker ps --format &amp;quot;{{.Names}}&amp;quot;)

 

Start Docker Container from Image


> docker run -it -p 443:8000 -p 80:80 --name <container> <sha256_image_id>

 

Start Bash in Docker Container


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

Exit Docker Interactive Terminal (Return to Host System)


> ctrl-p ctrl-q