-----------------------------------------
| DOCKER CHEAT SHEET |
------------------------------------------
**Docker Basics:**
1. **Docker Version:**
- `docker --version`: Display Docker version info.
2. **Docker Information:**
- `docker info`: Show system-wide information.
3. **Docker Containers:**
- `docker run <image>`: Create and start a new container.
- `docker ps`: List running containers.
- `docker ps -a`: List all containers (including stopped ones).
- `docker stop <container>`: Stop a running container.
- `docker rm <container>`: Remove a stopped container.
4. **Docker Images:**
- `docker images`: List available images.
- `docker rmi <image>`: Remove an image.
5. **Docker Volumes:**
- `docker volume create <volume-name>`: Create a volume.
- `docker volume ls`: List volumes.
- `docker volume rm <volume-name>`: Remove a volume.
**Building and Running Containers:**
6. **Dockerfile:**
- Create a Dockerfile to define container configuration.
7. **Building Images:**
- `docker build -t <image-name> .`: Build an image from a Dockerfile.
8. **Running Containers with Options:**
- `docker run -d <image>`: Run in detached mode (background).
- `docker run -it <image>`: Run interactively (with terminal).
- `docker run -p <host-port>:<container-port> <image>`: Map ports.
- `docker run --name <container-name> <image>`: Assign a name.
**Docker Networking:**
9. **Docker Network:**
- `docker network create <network-name>`: Create a custom network.
- `docker network ls`: List networks.
- `docker network inspect <network-name>`: View network details.
**Managing Containers:**
10. **Container Logs:**
- `docker logs <container>`: Display container logs.
- `docker logs -f <container>`: Follow logs in real-time.
11. **Container Exec:**
- `docker exec -it <container> <command>`: Execute a command in a running container.
12. **Copying Files:**
- `docker cp <container>:<source-path> <destination-path>`: Copy files between host and container.
**Docker Compose:**
13. **Docker Compose Basics:**
- Define and run multi-container applications.
14. **Docker Compose Commands:**
- `docker-compose up`: Start services.
- `docker-compose down`: Stop services and remove containers.
- `docker-compose ps`: List containers in the project.
**Docker Hub and Registry:**
15. **Docker Hub:**
- [Docker Hub](https://hub.docker.com/): Explore, share, and pull Docker images.
16. **Push and Pull Images:**
- `docker push <image-name>`: Upload image to a registry.
- `docker pull <image-name>`: Download image from a registry.
**Docker Cleanup:**
17. **Cleanup Unused Resources:**
- `docker system prune`: Remove unused containers, networks, and volumes.
**Docker Resources:**
18. **Official Docker Documentation:**
- [Docker Official Documentation](https://docs.docker.com/)
19. **Docker Community:**
- [Docker Community Forums](https://forums.docker.com/)
- [Docker Community Slack](https://community.docker.com/)
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......