Last active
October 3, 2015 11:22
-
-
Save kurorido/34abd6c24a1976eede13 to your computer and use it in GitHub Desktop.
docker cheat sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 停止所有 container 並且 remove | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) | |
# 用 image 執行 container | |
sudo docker run -idt <image> | |
-d flag which tells Docker to run the container in the background. | |
# 執行 container 並且印出 env | |
docker run --rm --name <name> <image> env | |
# 查看 container log | |
docker logs -f <container> | |
-f flag causes the docker logs command to act like the tail -f command and watch the container’s standard out. | |
# 查看執行中的 process | |
docker top <container> | |
# 進入 container (起一個 bash process) | |
sudo docker exec -ti <container_name> bash | |
# 單一進入 container | |
sudo docker attach <container_name> | |
docker restart <container_name> | |
# 刪除 image | |
docker rmi <image> | |
# 查看 container 的 meta | |
docker inspect <container> | |
# 查看 link meta | |
docker inspect -f "{{ .HostConfig.Links }}" <container> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment