Docker
Image Management:
docker pull <image>
: Download an image from a registry (e.g., Docker Hub)docker images
: List all local imagesdocker rmi <image>
: Remove an image
Container Management:
docker run -it <image>
: Run an interactive container from an imagedocker ps
: List all running containersdocker stop <container>
: Stop a running containerdocker rm <container>
: Remove a stopped container
Building Images:
docker build -t <image_name> .
: Build an image from a Dockerfile in the current directory
Network:
docker network create <network_name>
: Create a new networkdocker run -d --network <network_name> <image>
: Run a container attached to a specific network
Volumes:
docker run -v <host_path>:<container_path> <image>
: Mount a local directory to a container path
Remember: Replace <image>
, <container>
, <image_name>
, etc. with your desired names.
Bonus:
docker search <term>
: Search for images on Docker Hubdocker login
: Login to Docker Hub (for private images)docker help <command>
: Get detailed help for a specific command