To display the list of images |
docker images |
To display the available container |
docker ps |
To login in to dockerhub |
docker login |
To find out images in the hub |
docker search <image name> |
To tag image in dockerhub |
docker tag <image_name> <dockerhub_username>/<repository_name>:<tag> |
To push an image to dockerhub |
docker push <dockerhub_username>/<repository_name>:<tag> |
To pull an image from dockerhub |
docker pull <image_name>:tag |
To build a docker file |
docker build <path_to_dockerfile_directory> -t <image_name> |
To run a container in detached mode |
docker run -d <image_name>:tag |
To run a container in detached mode and bind it to specific host port |
docker run -d -p <host port>:<container port> <image_name>:tag |
To stop a container |
docker stop <container_name> |
To remove a container |
docker rm <container_name> |
To check the status of container |
systemctl status docker |
To start docker |
systemctl start docker |
To start docker automatically when the system restarts |
systemctl enable docker |
To use docker without sudo |
sudo usermod -aG $USER |
To run docker container in an interactive terminak |
docker run -it <image_name> /bin/bash |
To exit from a docker interactive terminal |
exit |
To get container details |
docker container inspect <container_name> |
To show the logs of a container |
docker logs <container> |
To show stats of running containers |
docker stats |