Cheatsheet for Docker
Account commands
docker login
- Register or log in to a Docker registrydocker logout
- Log out from a Docker registry
Basic Commands
docker pull
- Pull image or repository from a Docker registrydocker push
- Push an image or repository to a Docker registrydocker tag [IMAGE] [NAME:TAG]
- Tag a docker image with name and chosen tagdocker build [PATH | URL]
- Build an image from a Dockerfile located in PATH or URLdocker images
- List all Docker imagesdocker ps
- List all Docker containers
Tagging example
bash1docker tag <image hash> <dockerhub repo/name>:latest2docker push <dockerhub repo/name>:latest
Container Commands
docker cp [LOCAL PATH] [CONTAINER:DEST_PATH
- Copy files from host to Docker containerdocker cp [CONTAINER:PATH] [LOCAL PATH]
- Copy files from Docker container to local pathdocker attach CONTAINER
- Attach local standard input, ouput and error streams to a running Docker containerdocker run
- Run a command in a new Docker containerdocker start
- Start one or more stopped Docker containersdocker stop
- Stop a running Docker container
Cleaning Up
docker rmi
- Remove one or more imagesdocker rm
- Remove one or more containersdocker system prune
- Remove unused datadocker system prune -a
- Remove all unused images
Webmentions
0 Like 0 Comment