Docker的常用命令的集合
阿新 • • 發佈:2021-09-08
1 attach Attach to a running container # 當前 shell 下 attach 連線指定執行映象 2 build Build an image from a Dockerfile # 通過 Dockerfile 定製映象 3 commit Create a new image from a container changes # 提交當前容器為新的映象 4 cp Copy files/folders from the containers filesystem to the host path \#從容器中拷貝指定檔案或者目錄到宿主機中 5 create Create a new container # 建立一個新的容器,同 run,但不啟動容器 6 diff Inspect changes on a container's filesystem # 檢視 docker 容器變化 7 events Get real time events from the server # 從 docker 服務獲取容器實時事件 8 exec Run a command in an existing container # 在已存在的容器上執行命令 9 export Stream the contents of a container as a tar archive # 匯出容器的內容流作為一個 tar 歸檔檔案[對應 import ] 10 history Show the history of an image # 展示一個映象形成歷史 11 images List images # 列出系統當前映象 12 import Create a new filesystem image from the contents of a tarball # 從 tar包中的內容建立一個新的檔案系統映像[對應export] 13 info Display system-wide information # 顯示系統相關資訊 14 inspect Return low-level information on a container # 檢視容器詳細資訊 15 kill Kill a running container # kill 指定 docker 容器 16 load Load an image from a tar archive # 從一個 tar 包中載入一個映象[對應 save] 17 login Register or Login to the docker registry server # 註冊或者登陸一個 docker 源伺服器 18 logout Log out from a Docker registry server # 從當前 Docker registry 退出 19 logs Fetch the logs of a container # 輸出當前容器日誌資訊 20 port Lookup the public-facing port which is NAT-ed to PRIVATE_PORT # 檢視對映埠對應的容器內部源埠 21 pause Pause all processes within a container # 暫停容器 22 ps List containers # 列出容器列表 23 pull Pull an image or a repository from the docker registry server # 從docker映象源伺服器拉取指定映象或者庫映象 24 push Push an image or a repository to the docker registry server # 推送指定映象或者庫映象至docker源伺服器 25 restart Restart a running container # 重啟執行的容器 26 rm Remove one or more containers # 移除一個或者多個容器 27 rmi Remove one or more images # 移除一個或多個映象[無容器使用該映象才可刪除,否則需刪除相關容器才可繼續或 -f 強制刪除] 28 run Run a command in a new container # 建立一個新的容器並執行一個命令 29 save Save an image to a tar archive # 儲存一個映象為一個 tar 包[對應 load] 30 search Search for an image on the Docker Hub # 在 docker hub 中搜索映象 31 start Start a stopped containers # 啟動容器 32 stop Stop a running containers # 停止容器 33 tag Tag an image into a repository # 給源中映象打標籤 34 top Lookup the running processes of a container # 檢視容器中執行的程序資訊 35 unpause Unpause a paused container # 取消暫停容器 36 version Show the docker version information # 檢視 docker 版本號 37 wait Block until a container stops, then print its exit code # 擷取容器停止時的退出狀態值