Day20:Docker Cheatsheet
Here we will see some important Docker Commands
Docker Commands:
Docker pull: Pulls an image or a repository from a registry.
docker pull <image-name>
Docker push: Pushes an image or a repository to a registry.
docker push <image-name>
Docker images: Show a list of all the images on the local system.
docker images
Docker rmi: Removes one or more images.
docker rmi <image-name>
Docker build: Build and tag an image from a Dockerfile.
docker build [OPTIONS] PATH | URL |
docker build -t <image_name> .
Docker run: Runs a command in a new container. assign it a name and map a port. start container in background with -d option.
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
docker run -d --name <container-name> -p 80:80 <image-name>
Docker start: Starts one or more stopped containers.
docker start <container-name>
Docker stop: Stops one or more running containers.
docker stop <container-name>
Docker exec: Runs a command in a running container and go inside a container.
docker exec -it <container-name or ID> bash
Docker rm: Removes one or more containers.
docker rm <container-name or ID>
Docker ps: It shows list of all running containers.
docker ps
Docker ps -a: It shows a list of all containers.
docker ps -a
Docker logs: Fetches the logs of a container.
docker logs <container-name or ID>
Docker inspect: Returns low-level information on a container or image.
docker inspect <container-name or ID>
Docker Port: Show mapped ports of container.
docker port <container-name or ID>
Docker Top: Lists the processes running inside the container.
docker top <container-name or ID>
Docker Volume
Docker volume create: Create a volume
docker volume create <volume-name>
Docker volume ls : List volumes
docker volume ls
Docker volume inspect : Display detailed information on one or more volumes
docker volume inspect <volume-name>
Docker volume rm : Remove one or more volumes
docker volume rm <volume-name>
Docker volume prune : Remove all unused volumes
docker volume prune
Docker Compose:
Docker-compose up: Create and start containers
docker-compose up
Docker-compose ps: List containers
docker-compose ps
Docker-compose down: Stop and remove containers, networks, images, and volumes
docker-compose down
Docker-compose logs: Show logs
docker-compose logs <service>
Thank you for reading!! I Hope you find this article helpful!!
Happy Learning!!
Sayali ✨