Docker Intro: Common Commands Crash Course

December 20, 2021
Tags:
docker

We'll cover the common docker commands. These are good to learn when you first get started with Docker. It's also a great refresher if you're already experienced with Docker.

Lifecycle Commands

docker run    # starts a new container
docker ps     # shows running containers
docker exec   # hops or "ssh" into a container
docker stop   # stops a container
docker rm     # removes a stopped container
docker start  # start back up a stopped container

Registry Commands

docker build  # builds an image from a Dockerfile
docker images # lists the pulled or built images
docker push   # pushes the image to a docker registry

Cleanup Commands

docker rm `docker ps -a -q`
docker rm $(docker ps -a | grep 'Exited' | awk '{print $1}')
docker rmi $(docker images | grep MYNAME_ | awk '{print $3}')

Commands from the Video

docker run --rm -ti boltops/docker-tutorial bash
docker run --rm -P -d boltops/docker-tutorial
docker ps
docker ps -a
docker exec -ti beautiful_diffie bash 
docker rm beautiful_diffie
docker start thirsty_chatelet 
docker stop thirsty_chatelet 
docker build -t boltops/docker-tutorial:latest .
docker images
docker push boltops/docker-tutorial:latest    
docker rm $(docker ps -a -q)
docker rm $(docker ps -a | grep 'Exited' | awk '{print $1}')
docker rmi $(docker images | grep MYNAME_ | awk '{print $3}')

Get full access to these great resources

All for less than the price of coffee a day

27 courses
184 lessons
28+ hours

Get started with BoltOps Learn now and get access to easy and powerful lessons

BoltOps Tools