Source: https://docs.docker.com/get-started/docker_cheatsheet.pdf
- Docker cli - Docker CLI is the command line interface for Docker
- Docker Desktop - Docker Desktop is available for Mac, Linux, and Windows
docker --help
- Get help with Docker. You can use--help
on all subcommandsdocker info
- Display system-wide information- Docker Docs - Check out our docs for information on using Docker
docker run --name <container_name> <image_name>
- Create and run a container from an image, with a custom namedocker run -p <host_port>:<container_port> <image_name>
- Run a container and publish a container’s port(s) to the hostdocker run -d <image_name>
- Run a container in the backgrounddocker start|stop <container_name> (or <container-id>)
- Start or stop an existing containerdocker rm <container_name>
- Remove a stopped containerdocker exec -it <container_name> sh
- Open a shell inside a running containerdocker logs -f <container_name>
- Fetch and follow the logs of a containerdocker inspect <container_name> (or <container_id>)
- Inspect a running containerdocker ps
- List currently running containersdocker ps --all
- List all docker containers (running and stopped)docker container stats
- View resource usage stats
docker build -t <image_name>
- Build an Image from a Dockerfiledocker build -t <image_name> . --no-cache
- Build an Image from a Dockerfile without the cachedocker images
- List local imagesdocker rmi <image_name>
- Delete an Imagedocker image prune
- Remove all unused images
The default registry is Docker Hub, but you can add more registries.
docker login -u <username>
- Login into Dockerdocker push <username>/<image_name>
- Publish an image to Docker Hubdocker search <image_name>
- Search Hub for an imagedocker pull <image_name>
- Pull an image from Docker Hubdocker tag <image_name>:<tag> <username>/<image_name>:<tag>
- Tag an image for a registry