# List all the available docker images
docker images
# Pull the ubuntu docker image
docker pull ubuntu
# History of the docker image (list of all commands that was run to build the image)
docker image history ubuntu
# List all running docker containers
docker ps
# List all containers (both running & exited containers)
docker ps -a
# Docker run an nginx container
docker run -it --rm -v ${PWD}:/test -w /test -p 80:80 --name t1-pod nginx hostname -I
# Start a docker container
docker start containerID or Name
# Stop a docker container
docker stop containerID or Name
# Remove a docker container
docker rm -f containerID or Name
# Kill a docker container
docker kill containerID or Name
# Run a detached container, remove it automatically after running
docker run -d --rm -v ${PWD}:/test -w /test -p 80:80 --name t1-pod nginx
# Run an alpine container and mount home directory and current working directory
docker run --rm -it -v ${PWD}:/work -w /work -v ${HOME}:/root/ --net host alpine sh
# List only the container ID
docker ps -aq