Guest User

Untitled

a guest
Sep 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. ```
  2. #------------------------
  3. # check container
  4. #------------------------
  5. $ docker ps
  6.  
  7. #------------------------
  8. # check all containers
  9. #------------------------
  10. $ docker ps -a
  11.  
  12. #------------------------
  13. # delete container
  14. #------------------------
  15. $ docker rm <container id>
  16.  
  17. #------------------------
  18. # delete all containers
  19. #------------------------
  20. $ docker rm `docker ps -a -q`
  21.  
  22. #------------------------
  23. # check images
  24. #------------------------
  25. $ docker images
  26.  
  27. #------------------------
  28. # delete image
  29. # - will report error if image does not exists
  30. #------------------------
  31. $ docker rmi <image id>
  32.  
  33. #------------------------
  34. # force delete image
  35. #------------------------
  36. $ docker rmi -f <image id>
  37.  
  38. #------------------------
  39. # delete all images
  40. #------------------------
  41. # - before 1.12
  42. $ docker rmi `docker images -q`
  43.  
  44. # - after 1.13
  45. $ docker image prune
  46.  
  47.  
  48. #------------------------
  49. # docker status
  50. #------------------------
  51. $ docker stats
  52.  
  53. #------------------------
  54. # check mount status
  55. #------------------------
  56. $ docker inspect -f "{{ .Mounts }} <container id>
  57.  
  58. # e.g.
  59. $docker inspect -f "{{ .Mounts }}" 8a3da5488a83
  60. [{bind /Users/kuniyasu/Work/docker/docker-cluster/node2/data /usr/share/elasticsearch/data rw true rprivate}]
  61.  
  62.  
  63. ```
  64. #------------------------
  65. # login to the container as root
  66. #------------------------
  67. $ docker exec -it --user root <container id> /bin/bash
  68.  
  69. #------------------------
  70. # Remove unused data, it will prompt you for the following:
  71. # WARNING! This will remove:
  72. # - all stopped containers
  73. # - all networks not used by at least one container
  74. # - all dangling images
  75. # - all build cache
  76. #------------------------
  77. $ docker system prune
  78.  
  79. #------------------------
  80. # copy file between native OS to docker
  81. #------------------------
  82. $ docker cp /tmp/kibana.yml <container id>:/usr/share/kibana/config/kibana.yml
  83.  
  84. #------------------------
  85. # add modified docker image to local for future usage.
  86. #------------------------
  87. docker commit -m 'comment' <container id> my_repo:tag
  88.  
  89. # Some files to modify the init script for docker
  90. /usr/local/bin/docker-entrypoint.sh
  91. /usr/share/logstash/bin/system-install
  92. /usr/share/logstash/config/startup-options
  93.  
  94. ```
  95. ```
Add Comment
Please, Sign In to add comment