Useful Docker Commands: List, Stop, Remove, Logs, Build, Push, Pull, and Delete Images


refer to cmd


# List all running containers
docker ps

# List all containers, including stopped ones
docker ps -a

# Stop a running container
docker stop <container-id>

# Remove a stopped container
docker rm <container-id>

# View logs from a container
docker logs <container-id>

# Execute a command in a running container
docker exec <container-id> <command>

# Build an image from a Dockerfile
docker build -t <image-name> <path-to-dockerfile>

# Push an image to a Docker registry
docker push <registry>/<image-name>

# Pull an image from a Docker registry
docker pull <registry>/<image-name>

# Remove all Docker images using prune option
docker image prune -a -f


Thank you.



No comments:

Post a Comment