Cheatography
https://cheatography.com
Basic Docker Commandsdocker ps | List of live containers | docker ps -a | List all containers | docker info | Retrieves docker configuration | docker version | Retrieves docker versioning | docker build -t <Image>:<Tag> . | Builds a docker Image from Dockerfile or container | docker push <Image_Name>:<Tag> | Pushes the image to the repo | docker pull<Image_Name>:<Tag> | Pulls the image from the repo |
Container Commandsdocker inspect <Container> | Inspect a container | docker stats <Container> | Live data stream from container | docker logs <Container> | Retrieves the containers logs | docker run <Container> | Run container | docker kill <Container> | Kill a running container | docker start <Container> | Start container | docker stop <Container> | Stop a running container | docker restart <Container> | Restarts the container | docker rm <Container> | Remove container | docker port <Container> | Lists the port mapping of the container | docker pause <Container> | Suspends all the processes in the container | docker unpause <Container> | Un-suspends all the processes in the container |
<Container> can be replaced with the containers ID or NAME
Volume Commandsdocker volume ls | List volumes | docker volume inspect <Volume> | Inspect volume | docker volume create <Volume> | Create volume | docker volume rm <Volume> | Removes a volume |
<Volume> can be replaced with the volume ID or NAME
Misc. Commandsdocker cp <Container>:<source_path> <dest_path> | Copy from container to host | docker cp <source_path> <Container>:<dest_path> | Copy from host to container | docker exec -ti <Container> <Entrypoint> | Executes the terminal of a live container |
| | Options Keywords-p, –-publish | Host to container port mapping | --publish-all | Publish all ports | --expose | Expose container port | -d, –-detach | Run in background | -e, –-env | set env vars | -v, --volume | Mount files or directories | -i, --interactive | -t, --tty | exec | Run a new command in a container | cp | copy path |
These options keywords can be add to most docker commands
Image Commandsdocker images | List images | docker run <Image> | runs the image | docker create <Image>:<Tag> | Create image | docker rmi <Image> | Remove image | docker save <Image> | Saves images to a tar archive |
Network Commandsdocker network ls | List networks | docker network inspect <Network> | Inspect a network | docker network create <Network> | Create a network | docker network rm <Network> | Removes a network | docker network connect <Network> <Container> | Connect a container to the network | docker network connect --ip <IP> <Network> <Container> | Specify the ip address of container interface | docker network disconnect <Network_Name> <Container> | Disconnect container from network |
<Network> can be replaced with the network ID or NAME
|
Help Us Go Positive!
We offset our carbon usage with Ecologi. Click the link below to help us!
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets