Install

Windows 10

See https://docs.docker.com/docker-for-windows/

Linux Ubuntu

Install Docker Engine and Docker Compose separately:
See https://docs.docker.com/engine/install/ubuntu/
See https://docs.docker.com/compose/install/

Commands

Commands can be run from Bash or PowerShell.

Flags
--help
--version
Pull

Get the latest image of Ubuntu server off of Docker Hub

docker pull ubuntu:latest

Get the a specific version of Ubuntu server off of Docker Hub by tag name

docker pull ubuntu:18.04
Run
docker run hello-world
docker run --interactive --tty ubuntu bash
docker run --detach --publish 80:80 --name webserver nginx
docker run -p 8983:8983 -t solr

Name a container and run it in detached mode

docker run -p 8983:8983 -t solr --name solr -d

What's running?

docker ps
docker ps -aq
List

Images

docker images
docker image ls
docker images -f “dangling=true” -q

Containers

docker container ls
docker container ls --all

Volumes, networks

docker volume
docker network
Remove

Images

docker image rm 182712361A
docker image rm 182712361A 9934812348
docker image rm wordpress:latest
docker image prune -a

Beginning with:

docker rmi $(docker images -a | grep "^<none>" | awk '{print $3}')
docker rmi $(docker images -a | grep "^acrpmma" | awk '{print $3}')

Tagged with:

docker rmi $(docker images -a | grep "<none>" | awk '{print $3}')

Stop containers

docker container stop webserver
docker stop $(docker ps -aq)
sudo docker stop $(sudo docker ps -aq)

Remove containers

docker container rm webserver laughing_kowalevski relaxed_sammet
docker rmi -f c0fdfb66599d
docker rm $(docker ps -aq)
sudo docker rm $(sudo docker ps -aq)

Volumes, networks

docker volume prune
docker network prune
Exec

Access command

docker exec -it appname /bin/bash
docker exec -it -u root solr /bin/bash
docker exec -it -u 0 solr /bin/bash
docker-compose exec kube_api_service /bin/bash
Build

See https://docs.docker.com/engine/reference/commandline/build/

docker build -t solr:8.11.1 .
Tag
docker tag solr:8.11.1 acrpmma.azurecr.io/solr:8.11.1
Push
docker push acrpmma.azurecr.io/solr:8.11.1
Commit

Commit a build to Docker Hub Repository

docker commit df75aa301d62 ubuntu:18.04vim
Docker-Compose
docker-compose up -d
docker-compose --verbose up
Docker-Compose - restart a service locally
s=servicename
docker-compose kill $s && 
docker-compose rm -f $s && \
docker-compose build $s && \
docker-compose up -d && \
docker-compose logs -f $s
docker pull thing.azurecr.io/solr-all:qarelease && \
docker tag thing.azurecr.io/solr-all:qarelease thing.azurecr.io/solr-all:qarollback && \
docker push thing.azurecr.io/solr-all:qarollback && \
docker build -t thing.azurecr.io/solr-all:qarelease . && \
docker tag thing.azurecr.io/solr-all:qarelease thing.azurecr.io/solr-all:qarelease && \
docker push thing.azurecr.io/solr-all:qarelease