docker --help |
To get help from Docker CLI. |
docker -d |
To start the Docker daemon. |
docker info |
To display Docker system-wide information. |
docker version |
To display the current installed Docker version. |
Docker Hub Commands |
Docker Hub is a service provided by Docker that hosts container images. You can download and even push your own images in Docker Hub, making it accessible to everyone connected to the service. |
docker login -u <username> |
To login into Docker. |
docker push <username>/<image_name> |
To publish an image to Docker Hub. |
docker search <image_name> |
To search for an image in Docker Hub. |
docker pull <image_name> |
To pull an image from the Docker Hub. |
Docker Images Commands |
The following commands allow you to work with Docker images. |
docker build |
To build an image from a Dockerfile. |
docker commit <container_name> |
To create a new image from a container’s changes. |
docker history <container_name> |
To show the history of an image. |
docker images |
To list images. |
docker import |
To import the contents from a tarball to create a filesystem image. |
docker load |
To load an image from a tar archive or STDIN. |
docker rmi <container_name> |
To remove one or more images. |
docker save <container_name> |
To save images to a tar archive or STDOUT. |
docker tag |
To tag an image into a repository. |
Docker Container Commands |
Managing containers is a day-to-day activity of DevOps teams. Here is a list of Docker commands to manage containers. |
docker run --name <container_name> <image_name> |
To create and run a container from an image. |
docker run -p <host_port>:<container_port> <image_name> |
To run a container with port mapping. |
docker run -d <image_name> |
To run a container in the background. |
docker start|stop <container_name> |
To start or stop an existing container. |
docker rm <container_name> |
To remove a stopped container. |
docker exec -it <container_name> sh |
To open a shell inside a running container. |
docker logs -f <container_name> |
To fetch and follow the logs of a container. |
docker inspect <container_name> |
To inspect a running container. |
docker ps |
To list currently running containers. |
docker ps -a |
To list all Docker containers. |
docker container stats |
To view resource usage stats. |