Basic Docker Commands:
docker --version get the installed docker version
docker pull hello-world download the image "hello-world" from the docker
repository (hub.docker.com)
docker images list all the images that are locally stored with the
docker engine
docker run hello-world create a container from the image "hello-world"
docker container ls -a list all containers
docker container ls -a -s list the size for all containers
docker rmi 515d5e66f68a remove the docker image "hello-seattle" with
image id "515d5e66f68a"
docker rm d9bf06498bb2 remove the docker container with container id
"d9bf06498bb2"
docker history hello-world display the history of the image "hello-world"
docker info get detailed information about docker installed
on the system including the kernel version,
number of containers and images, etc.
docker volume create create a volume which docker container will
use to store data
docker volume ls list all the volumes known to Docker
docker logs c70201336fd8 display the logs of the docker container with
contained id "c70201336fd8"
docker search hadoop search for docker image "hadoop" on
dockerhub
docker network ls list all docker networks
docker login login into docker repository (hub.docker.com)
docker logout logout from docker repository (hub.docker.com)
docker start c70201336fd8 start the docker container with container id
"c70201336fd8"
docker stop c70201336fd8 stop the docker container with container id
"c70201336fd8"
docker restart c70201336fd8 restart the docker container with container id
"c70201336fd8"
docker inspect c70201336fd8 get detailed information about the docker
container with container id "c70201336fd8"
docker stats c70201336fd8 get the statistics of the docker container with
container id "c70201336fd8"
docker image ls List all images that are locally stored with the
docker engine.
docker system prune delete all unused containers, unused
networks, and dangling images
systemctl status docker check the Docker service
systemctl start docker start the Docker service
docker image prune remove unused images
docker save hello-world > hello-world.tar save the image "hello-world" to a tar
archive
docker load < hello-world.tar load the image "hello-world" from the
saved tar file
docker export a27999b71e62 > hello-world.tar export the docker container with
container id " a27999b71e62" as a tar
archive
docker import hello-world.tar import the contents from hello-world.tar