docker psLists all running containers.
docker ps -aLists all containers, including those that are stopped.
docker start <container_name>Starts a stopped container.
docker stop <container_name>Stops a running container.
docker rm <container_name>Removes a container. Use -f to force remove a running container.
docker rmi <image_name>Removes an image from the local storage.
docker build -t <image_name> .Builds an image from the Dockerfile in the current directory.
docker run -d --name <container_name> <image_name>Runs a container from an image in detached mode.
docker imagesLists all images stored locally.
docker logs <container_name>Displays logs from a container.
docker exec -it <container_name> /bin/bashOpens an interactive terminal session in a running container.
Docker Compose is a tool for defining and running multi-container Docker applications. Here are some basic commands:
docker-compose upStarts and runs all the services defined in a docker-compose.yml file.
docker-compose downStops and removes all containers, networks, and volumes defined in a docker-compose.yml file.