Command | Comments |
---|---|
docker --version |
|
docker pull <image[:tag]> |
|
docker run -it --rm <image[:tag]> |
interactive, tty, auto-cleanup |
docker run -it --rm <image[:tag]> /bin/bash |
|
docker run -it --rm --endpoint /bin/bash <image[:tag]> |
|
docker ps |
Short for docker container ls |
docker ps -a |
-a = Include stopped containers |
docker ps -aq |
-q = just container IDs |
docker stop <container> |
|
docker start <container> |
|
docker kill <container> |
|
docker rm <container> |
|
docker rmi <image> |
|
docker build -f ./path/to/Dockerfile -t <tag> |
|
docker images |
same as docker image ls |
docker history <image> |
|
docker attach <container> |
|
docker restart <container> |
stop container, after 10 secs kill, then start again. |
docker rename <container> <new name> |
|
docker |
|
docker |
Command | Comments |
---|---|
docker attach <container> |
Attach local standard input, output, and error streams to a running container. Use CTRL-p CTRL-q to detach. Must have been started with -t |
docker exec -it <container> <command> [...args] |
|
docker |
|
docker |
|
docker |
Command | Comments |
---|---|
docker volume prune |
Remove unused volumes (a stopped container = used) |
docker cp <container>:<path> <host path> |
copy out |
docker cp <host path> <container>:<path> |
copy in |
docker cp <container>:<path> - |
print contents to stdout |
docker export -o blah.tar <container> |
|
docker import ./file.[tar,.tgz,bzip,...] <imagename:tag> |
|
docker diff <container> |
|
docker checkpoint create <container> <checkpoint> |
(experimental) |
docker checkpoint ls |
(experimental) |
docker start --checkpoint <checkpoint> <container> |
(experimental) |
docker checkpoint remove <container> <checkpoint> |
(experimental) |
`` |
Command | Comments |
---|---|
docker network connect <network> <container> |
Attach network to running container |
`` | |
`` | |
`` | |
`` |
Command | Comments |
---|---|
docker login -u <username> --password-stdin <docker.server.com> |
|
docker commit <container> <repo<:tag>> |
|
docker push |
|
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG] |
Command | Comments |
---|---|
docker port <container> |
Get publicly exposed ports |
docker port <container> 1234/tcp |
Find where we exposed the containers port |
Command | Comments |
---|---|
DOCKERDIR=~/Library/Containers/com.docker.docker socat -dd $DOCKERDIR/Data/debug-shell.sock pty,rawer screen /dev/ttys001 |
Screen into linux VM |