<Docker 2> Docker的常用命令簡介

頁內導航

Docker命令

安裝完Docker之后匕累,在控制臺中輸入

docker --help

可以查看所有的Docker命令,其中常用的命令如下:

Usage:  docker COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default "/Users/****/.docker")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/Users/****/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/Users/****/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/Users/****/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:
  container   Manage containers 管理container
  image       Manage images 管理docker鏡像
  volume      Manage volumes 管理數據卷

Commands:
  build       Build an image from a Dockerfile 從Dockerfile編譯一個鏡像
  commit      Create a new image from a container''s changes 從一個現有container編譯一個鏡像
  cp          Copy files/folders between a container and the local filesystem 在宿主機器和container之間傳遞文件和文件夾
  exec        Run a command in a running container 在一個運行中的container上執(zhí)行命令
  images      List images 列出所有的鏡像
  inspect     Return low-level information on Docker objects 查看詳細docker各部件的詳細信息
  kill        Kill one or more running containers 停止一個container
  login       Log in to a Docker registry 登錄到docker hub
  logout      Log out from a Docker registry 登出
  port        List port mappings or a specific mapping for the container 羅列當前container的所有端口映射關系
  ps          List containers 顯示正在運行的container
  pull        Pull an image or a repository from a registry 從docker hub中獲取一個鏡像
  push        Push an image or a repository to a registry 發(fā)布一個鏡像到docker hub
  rename      Rename a container 重命名一個container
  restart     Restart one or more containers 重啟一個或者多個container
  rm          Remove one or more containers 移除一個或者多個container
  rmi         Remove one or more images 移除一個或多個鏡像
  run         Run a command in a new container 啟動一個新的container
  start       Start one or more stopped containers 啟動一個或多個container
  stop        Stop one or more running containers 停止一個或多個container
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE 從一個鏡像拷貝并重新命名為一個新的鏡像
  version     Show the Docker version information 顯示docker的版本信息

Run 'docker COMMAND --help' for more information on a command.

image 鏡像

docker images

顯示本地所有的鏡像

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
niweigede/ujava     1.1                 5a662682895c        2 hours ago         490MB
docker image
Commands:
  build       Build an image from a Dockerfile 
  history     Show the history of an image
  inspect     Display detailed information on one or more images
  ls          List images
  prune       Remove unused images
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rm          Remove one or more imagesSOURCE_IMAGE

container 容器

docker container
Commands:
  attach      Attach local standard input, output, and error streams to a running container
  commit      Create a new image from a container''s changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  exec        Run a command in a running container
  inspect     Display detailed information on one or more containers
  kill        Kill one or more running containers
  logs        Fetch the logs of a container
  ls          List containers
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  prune       Remove all stopped containers
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  run         Run a command in a new container
  start       Start one or more stopped containers
  stop        Stop one or more running containers
  top         Display the running processes of a container

系列文章

<Docker 1> Docker入門知識和安裝方式
<Docker 2> Docker的常用命令簡介 當前

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市谐丢,隨后出現的幾起案子揭蜒,更是在濱河造成了極大的恐慌,老刑警劉巖传藏,帶你破解...
    沈念sama閱讀 221,635評論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件腻暮,死亡現場離奇詭異,居然都是意外死亡毯侦,警方通過查閱死者的電腦和手機哭靖,發(fā)現死者居然都...
    沈念sama閱讀 94,543評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來侈离,“玉大人试幽,你說我怎么就攤上這事∝阅耄” “怎么了铺坞?”我有些...
    開封第一講書人閱讀 168,083評論 0 360
  • 文/不壞的土叔 我叫張陵起宽,是天一觀的道長。 經常有香客問我济榨,道長坯沪,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,640評論 1 296
  • 正文 為了忘掉前任擒滑,我火速辦了婚禮腐晾,結果婚禮上,老公的妹妹穿的比我還像新娘橘忱。我一直安慰自己赴魁,他們只是感情好,可當我...
    茶點故事閱讀 68,640評論 6 397
  • 文/花漫 我一把揭開白布钝诚。 她就那樣靜靜地躺著颖御,像睡著了一般。 火紅的嫁衣襯著肌膚如雪凝颇。 梳的紋絲不亂的頭發(fā)上潘拱,一...
    開封第一講書人閱讀 52,262評論 1 308
  • 那天,我揣著相機與錄音拧略,去河邊找鬼芦岂。 笑死,一個胖子當著我的面吹牛垫蛆,可吹牛的內容都是我干的禽最。 我是一名探鬼主播,決...
    沈念sama閱讀 40,833評論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼袱饭,長吁一口氣:“原來是場噩夢啊……” “哼川无!你這毒婦竟也來了?” 一聲冷哼從身側響起虑乖,我...
    開封第一講書人閱讀 39,736評論 0 276
  • 序言:老撾萬榮一對情侶失蹤懦趋,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后疹味,有當地人在樹林里發(fā)現了一具尸體仅叫,經...
    沈念sama閱讀 46,280評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 38,369評論 3 340
  • 正文 我和宋清朗相戀三年糙捺,在試婚紗的時候發(fā)現自己被綠了诫咱。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,503評論 1 352
  • 序言:一個原本活蹦亂跳的男人離奇死亡洪灯,死狀恐怖坎缭,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤幻锁,帶...
    沈念sama閱讀 36,185評論 5 350
  • 正文 年R本政府宣布,位于F島的核電站边臼,受9級特大地震影響哄尔,放射性物質發(fā)生泄漏。R本人自食惡果不足惜柠并,卻給世界環(huán)境...
    茶點故事閱讀 41,870評論 3 333
  • 文/蒙蒙 一岭接、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧臼予,春花似錦鸣戴、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,340評論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至缰雇,卻和暖如春入偷,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背械哟。 一陣腳步聲響...
    開封第一講書人閱讀 33,460評論 1 272
  • 我被黑心中介騙來泰國打工疏之, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人暇咆。 一個月前我還...
    沈念sama閱讀 48,909評論 3 376
  • 正文 我出身青樓锋爪,卻偏偏與公主長得像,于是被迫代替她去往敵國和親爸业。 傳聞我的和親對象是個殘疾皇子其骄,可洞房花燭夜當晚...
    茶點故事閱讀 45,512評論 2 359