1. 程式人生 > >Docker 常用命令 總結

Docker 常用命令 總結

常用命令

總結一下常用命令:

其中<>闊起來的引數為必選,[]闊起來為可選

  • docker version 檢視docker的版本號,包括客戶端、服務端、依賴的Go等
  • docker info 檢視系統(docker)層面資訊,包括管理的images, containers數等
  • docker search <image> 在docker index中搜索image
  • docker pull <image> 從docker registry server 中下拉image
  • docker push <image|repository> 推送一個image或repository到registry
  • docker push <image|repository>:TAG 同上,指定tag
  • docker inspect <image|container> 檢視image或container的底層資訊
  • docker images TODO filter out the intermediate image layers (intermediate image layers 是什麼)
  • docker images -a 列出所有的images
  • docker ps 預設顯示正在執行中的container
  • docker ps -l 顯示最後一次建立的container,包括未執行的
  • docker ps -a
     顯示所有的container,包括未執行的
  • docker logs <container> 檢視container的日誌,也就是執行命令的一些輸出
  • docker rm <container...> 刪除一個或多個container
  • docker rm `docker ps -a -q` 刪除所有的container
  • docker ps -a -q | xargs docker rm 同上, 刪除所有的container
  • docker rmi <image...> 刪除一個或多個image
  • docker start/stop/restart <container>
     開啟/停止/重啟container
  • docker start -i <container> 啟動一個container並進入互動模式
  • docker attach <container> attach一個執行中的container
  • docker run <image> <command> 使用image建立container並執行相應命令,然後停止
  • docker run -i -t <image> /bin/bash 使用image建立container並進入互動模式, login shell是/bin/bash
  • docker run -i -t -p <host_port:contain_port> 將container的埠對映到宿主機的埠
  • docker commit <container> [repo:tag] 將一個container固化為一個新的image,後面的repo:tag可選
  • docker build <path> 尋找path路徑下名為的Dockerfile的配置檔案,使用此配置生成新的image
  • docker build -t repo[:tag] 同上,可以指定repo和可選的tag
  • docker build - < <dockerfile> 使用指定的dockerfile配置檔案,docker以stdin方式獲取內容,使用此配置生成新的image
  • docker port <container> <container port> 檢視本地哪個埠對映到container的指定埠,其實用docker ps 也可以看到

使用images新建一個container並登入

使用image來建立container:

[email protected]tankywoo-docker:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              13.10               5e019ab7bf6d        12 days ago         180 MB
ubuntu              saucy               5e019ab7bf6d        12 days ago         180 MB
ubuntu              12.04               74fe38d11401        12 days ago         209.6 MB
ubuntu              precise             74fe38d11401        12 days ago         209.6 MB

[email protected]:~# docker run -i -t 74fe38d11401 /bin/bash

[email protected]:/# cat /etc/issue
Ubuntu 12.04.4 LTS \n \l

使用repository來建立container, 這時預設使用tag為lastest的image:

[email protected]:~# docker run -i -t ubuntu /bin/bash
[email protected]:/# uname -a
Linux 442e1cc85a8d 3.8.0-25-generic #37~precise1-Ubuntu SMP Fri Jun 7 16:27:35 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[email protected]:/# cat /etc/issue
Ubuntu 14.04 LTS \n \l

[email protected]:/# exit

使用commit將一個container固化為一個image

[email protected]:~# docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
f1fd375204af        ubuntu:12.04        /bin/bash           10 minutes ago      Exited (127) 48 seconds ago                       lonely_colden

[email protected]:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              13.10               5e019ab7bf6d        12 days ago         180 MB
ubuntu              saucy               5e019ab7bf6d        12 days ago         180 MB
ubuntu              12.04               74fe38d11401        12 days ago         209.6 MB

提交當前container為一個image,順便帶上作者資訊,並指定repository 和 tag

[email protected]:~# docker commit -a "Tanky Woo <[email protected]>" f1fd375204af ubuntu:test
fe65a2781daea01c67c33f11868abe6d510833bca07b90fc681cdfe98a9196ac

[email protected]:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              test                fe65a2781dae        6 seconds ago       209.6 MB
ubuntu              13.10               5e019ab7bf6d        12 days ago         180 MB
ubuntu              saucy               5e019ab7bf6d        12 days ago         180 MB

attach一個執行中的容器

[email protected]:~# docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
e2e6c95f0bf5        ubuntu:test         /bin/bash           11 minutes ago      Exited (0) 11 minutes ago                       suspicious_mccarthy

啟動一個container:

[email protected]:~# docker start e2e6c95f0bf5
e2e6c95f0bf5

可以看此container到正在執行中:

[email protected]:~# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
e2e6c95f0bf5        ubuntu:test         /bin/bash           11 minutes ago      Up 2 seconds                            suspicious_mccarthy

attach這個container:

[email protected]:~# docker attach e2e6c95f0bf5

進入container:

[email protected]:/#

docker build 構建

[email protected]:~# cat Dockerfile
FROM ubuntu:test
ENTRYPOINT echo "Welcome!"

[email protected]:~# docker build -t ubuntu:newtest - < Dockerfile
Uploading context 2.048 kB
Uploading context
Step 0 : FROM ubuntu:test
 ---> fe65a2781dae
Step 1 : ENTRYPOINT echo "Welcome!"
 ---> Running in 09a062a296c5
 ---> f8104f05df90
Successfully built f8104f05df90
Removing intermediate container 09a062a296c5
[email protected]:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              newtest             f8104f05df90        8 seconds ago       209.6 MB
ubuntu              test                fe65a2781dae        23 minutes ago      209.6 MB
ubuntu              13.10               5e019ab7bf6d        12 days ago         180 MB
ubuntu              saucy               5e019ab7bf6d        12 days ago         180 MB
ubuntu              precise             74fe38d11401        12 days ago         209.6 MB
ubuntu              12.04               74fe38d11401        12 days ago         209.6 MB
ubuntu              12.10               a7cf8ae4e998        12 days ago         171.3 MB
ubuntu              quantal             a7cf8ae4e998        12 days ago         171.3 MB
ubuntu              14.04               99ec81b80c55        12 days ago         266 MB
ubuntu              trusty              99ec81b80c55        12 days ago         266 MB
ubuntu              latest              99ec81b80c55        12 days ago         266 MB
ubuntu              13.04               316b678ddf48        12 days ago         169.4 MB
ubuntu              raring              316b678ddf48        12 days ago         169.4 MB
ubuntu              10.04               3db9c44f4520        2 weeks ago         183 MB
ubuntu              lucid               3db9c44f4520        2 weeks ago         183 MB

[email protected]:~# docker run ubuntu:newtest
2014/05/07 17:30:34 Unrecognized input header
[email protected]:~# docker run -i -t ubuntu:newtest /bin/bash
Welcome!

TODO: 為何要使用 -i 和 -t

使用 docker run -p 的例子

映象ubuntu:12.04沒有vi,沒法編輯/etc/apt/sources.list

現在本地有一份,想上傳上去

首先對映埠(宿主的2222埠和container的33333埠對映):

docker run -i -t -p 22222:33333 fe65a2781dae /bin/bash

container上監聽33333:

nc -l -p 33333 > /etc/apt/sources.list

本地使用22222埠傳輸:

nc localhost 22222 < sources.list

檢視對映的埠

[email protected]:~# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                      NAMES
7abe8e31ac8b        ubuntu:test         /bin/bash           15 minutes ago      Up 15 minutes       0.0.0.0:22222->33333/tcp   hungry_carson

[email protected]:~# docker port 7abe8e31ac8b 33333
0.0.0.0:22222

[email protected]:~# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      528/sshd
tcp6       0      0 :::22222                :::*                    LISTEN      12946/docker
tcp6       0      0 :::22                   :::*                    LISTEN      528/sshd

但是這裡很好奇為啥是監聽在ipv4的地址上?

刪除image/container遇到的依賴關係

關於刪除時的依賴關係,按照提示刪除就行了

比如刪除images時,需要先刪除通過它建立的所有containers:

[email protected]:~# docker rmi 666c5d65f396 3494872e31a4 62fda5e450d5 5e1829f90d6e 89554a25c998
Error: Conflict, cannot delete 666c5d65f396 because the container 43a7072bac7a is using it
Error: Conflict, cannot delete 3494872e31a4 because the container 40b3cd8b2e42 is using it
Error: Conflict, cannot delete 62fda5e450d5 because the container 5142a3d092a6 is using it
Untagged: test:latest
Deleted: 5e1829f90d6e9ac09645841fe6ab85a0b0f9b28f008a571299a624e566684afe
Deleted: ae5ae236a8e1d946963a7c2c142cc892b1979cb9458e0ecac4d33d2283ace567
Untagged: memchaced:latest
Deleted: 89554a25c998d14c76ff885ddac7cc1a47ae4caf9edcddaa43408b402a1684fb
2014/05/07 15:44:41 Error: failed to remove one or more images

[email protected]:~# docker rm 43a7072bac7a 40b3cd8b2e42 5142a3d092a6
43a7072bac7a
40b3cd8b2e42
5142a3d092a6

且刪除images時也可能會遇到依賴其它的images,比如直接刪除父映象時,就會提示需要先刪除子映象。

可以通過:

docker images --tree

來檢視,不過官方提示 --tree 已經棄用了,會在以後的版本去掉.

首先清空所有containers:

[email protected]:~# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

然後以樹形結構檢視依賴關係:

[email protected]:~# docker images --tree
Warning: '--tree' is deprecated, it will be removed soon. See usage.
└─511136ea3c5a Virtual Size: 0 B
  ├─e2aa6665d371 Virtual Size: 106.1 MB
  │ └─f0ee64c4df74 Virtual Size: 106.3 MB
  │   └─2209cbf9dcd3 Virtual Size: 106.3 MB
  │     └─5e019ab7bf6d Virtual Size: 180 MB Tags: ubuntu:13.10, ubuntu:saucy
  ├─f10ebce2c0e1 Virtual Size: 103.7 MB
  │ └─82cdea7ab5b5 Virtual Size: 103.9 MB
  │   └─5dbd9cb5a02f Virtual Size: 103.9 MB
  │     └─74fe38d11401 Virtual Size: 209.6 MB Tags: ubuntu:precise, ubuntu:12.04
  │       └─fe65a2781dae Virtual Size: 209.6 MB Tags: ubuntu:test
  │         └─276cc641e40e Virtual Size: 388.3 MB Tags: ubuntu:newtest
  ├─ef519c9ee91a Virtual Size: 100.9 MB
  │ └─07302703becc Virtual Size: 101.2 MB
  │   └─cf8dc907452c Virtual Size: 101.2 MB
  │     └─a7cf8ae4e998 Virtual Size: 171.3 MB Tags: ubuntu:12.10, ubuntu:quantal
  ├─5e66087f3ffe Virtual Size: 192.5 MB
  │ └─4d26dd3ebc1c Virtual Size: 192.7 MB
  │   └─d4010efcfd86 Virtual Size: 192.7 MB
  │     └─99ec81b80c55 Virtual Size: 266 MB Tags: ubuntu:14.04, ubuntu:latest, ubuntu:trusty
  ├─02dae1c13f51 Virtual Size: 98.35 MB
  │ └─e7206bfc66aa Virtual Size: 98.54 MB
  │   └─cb12405ee8fa Virtual Size: 98.54 MB
  │     └─316b678ddf48 Virtual Size: 169.4 MB Tags: ubuntu:raring, ubuntu:13.04
  └─6cfa4d1f33fb Virtual Size: 0 B
    └─3db9c44f4520 Virtual Size: 183 MB Tags: ubuntu:10.04, ubuntu:lucid

現在準備刪除12.10版本的父映象 cf8dc907452c, 會提示有衝突,刪不掉:

[email protected]:~# docker rmi cf8dc907452c
Error: Conflict, cf8dc907452c wasn't deleted
2014/05/07 18:49:35 Error: failed to remove one or more images

但是可以刪除葉子節點 a7cf8ae4e998:

[email protected]:~# docker rmi a7cf8ae4e998
Untagged: ubuntu:12.10
Untagged: ubuntu:quantal
Deleted: a7cf8ae4e998c5339e769d6cc466f9133bd4d330a549bb846cb1641cd638247c
Deleted: cf8dc907452c970224551599da573c9e32897fc65286d942625c4c86dabd680d
Deleted: 07302703beccc2ea25f34333decad32ed06446e8a14c020ffbd0be017364b9fe
Deleted: ef519c9ee91a06fc33cefbda1bce27686617761700252dff0397f2c0e269f3c5

containers之間共享資料

docker 的 containers之間共享目錄是通過 volume 。

docker run 命令使用 -v 可以繫結一個volume, -v 可以使用多次,建立多個volume:

[email protected]:~# docker run -i -t -v /tmp/tankywoo --name data ubuntu:newtest /bin/bash                         [6/3516]

使用 mount 看到 /tmp/tankywoo 已經被mount了:

[email protected]:/# mount
none on / type aufs (rw,relatime,si=f7ac8b1595d13ed9)
...
/dev/disk/by-uuid/b77aed99-bb9b-4881-9702-4ed204fe5d46 on /tmp/tankywoo type ext3 (rw,relatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered)

檢視 /tmp/tankywoo 目錄下,是空的:

[email protected]:/tmp/tankywoo# ls
[email protected]:/tmp/tankywoo# 

然後在宿主機新建一個container,來繫結這個volume:

按照 docker run 的命令列引數:

  --volumes-from=[]: Mount volumes from the specified container(s)

有問題:

[email protected]:/tmp/tankywoo# docker run -i -t --volumes-from=["data"] ubuntu:newtest /bin/bash                       [21/158]
2014/05/08 15:58:19 Error: Cannot start container 5d83dcaf8f0220024e0403a362c0512a8218cfcb45dc911df5d2cd37f9a4e8a4: Container [data] not found. Impossible to mount its volumes

必須像short option的方式使用:

[email protected]:/tmp/tankywoo# docker run -i -t --volumes-from data ubuntu:newtest /bin/bash

[email protected]:/# mount
none on / type aufs (rw,relatime,si=f7ac8b15b25036d9)
...
/dev/disk/by-uuid/b77aed99-bb9b-4881-9702-4ed204fe5d46 on /tmp/tankywoo type ext3 (rw,relatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered)

也可以看到 /tmp/tankywoo 目錄,並且是空的,然後新建一個檔案:

[email protected]:/tmp/tankywoo# ls
[email protected]:/tmp/tankywoo# touch file
[email protected]:/tmp/tankywoo# ls
file

再看看之前那個container:

[email protected]:/tmp/tankywoo# ls
file

也有這個檔案了

參考

退出container但是保持執行

預設情況下,如果使用ctrl-c退出container,那麼container也會stop

ctrl-p ctrl-q可以退出到宿主機,而保持container仍然在執行

Docker被牆

關於 Docker 被牆,老甘的文章裡提到的修改hosts檔案,先mark,未驗證:

# /etc/hosts
54.234.135.251 get.docker.io 
54.234.135.251 cdn-registry-1.docker.io

遺留的問題

有時docker執行不了任何命令(會卡住),包括重啟docker server,在日誌裡看到這些:

May  5 17:41:48 tpl-ubuntu12-04 kernel: [99589.489241] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:41:58 tpl-ubuntu12-04 kernel: [99599.708117] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:42:08 tpl-ubuntu12-04 kernel: [99609.927057] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:42:18 tpl-ubuntu12-04 kernel: [99620.145993] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:42:29 tpl-ubuntu12-04 kernel: [99630.364922] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:42:39 tpl-ubuntu12-04 kernel: [99640.583850] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:42:49 tpl-ubuntu12-04 kernel: [99650.802794] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:42:59 tpl-ubuntu12-04 kernel: [99661.021726] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:43:10 tpl-ubuntu12-04 kernel: [99671.240662] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:43:20 tpl-ubuntu12-04 kernel: [99681.459572] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:43:30 tpl-ubuntu12-04 kernel: [99691.678530] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:43:40 tpl-ubuntu12-04 kernel: [99701.897432] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:43:51 tpl-ubuntu12-04 kernel: [99712.128370] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:44:01 tpl-ubuntu12-04 kernel: [99722.347289] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:44:11 tpl-ubuntu12-04 kernel: [99732.566226] unregister_netdevice: waiting for lo to become free. Usage count = 3
May  5 17:44:21 tpl-ubuntu12-04 kernel: [99742.785141] unregister_netdevice: waiting for lo to become free. Usage count = 3

什麼是Layer

Docker images are built up in layers. So, for instance, if you need to run WordPress, you would build the Ubuntu layer, add a layer for Apache2 web server, add a PHP layer and then a layer for the WordPress files. Lower layers can be re-used. We might take the PHP layer and layer on Drupal instead of WordPress, or update our WordPress layer with a newer version or Wordpress.

Because we can re-use layers, we can make new docker images very cheaply. We can create a new docker image by changing just a single line of one file and we do not have to rebuild the whole stack.

The beauty of docker images being “just files” means that the difference between two docker images is just a diff of the files they contain.

概念上的問題

Image : An image is a read only layer used to build a container. They do not change.

Container : Is basically a self contained runtime environment that is built using one or more images. You can commit your changes to a container and create an image.

index / registry : These are public or private servers where people can upload their repositories so they can easily share what they made.

Repository : A repository is a group of images located in the docker registry. There are two types of repositories, Top level and user repositories. Top level repositories don't have a '/' in the name and they are usually reserved for base images. These Top level repositories is what most people build their repositories on top of. They are controlled by the maintainers of Docker. User repositories are repositories that anyone can upload into the registry and share with other people.

說直接點,Image和Container最容易理解和對比,它倆的關係就像類與類的例項這兩的關係一樣。

其實Index和Registry也有區別,主要就是Index儲存的是使用者資訊、images的checksum;而Registry儲存的是images。具體見官方文件Registry & Index Spec

另外,關於Repository與Registry和Image又是什麼關係?

[email protected]:~/docker-registry-master# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
10.2.15.190/tankywoo        latest              276cc641e40e        4 days ago          388.3 MB
10.2.15.190:5000/tankywoo   latest              276cc641e40e        4 days ago          388.3 MB
ubuntu                  newtest             276cc641e40e        4 days ago          388.3 MB
ubuntu                  test                fe65a2781dae        4 days ago          209.6 MB
ubuntu                  13.10               5e019ab7bf6d        2 weeks ago         180 MB
ubuntu                  saucy               5e019ab7bf6d        2 weeks ago         180 MB
ubuntu                  12.04               74fe38d11401        2 weeks ago         209.6 MB
ubuntu                  precise             74fe38d11401        2 weeks ago         209.6 MB
ubuntu                  14.04               99ec81b80c55        2 weeks ago         266 MB
ubuntu                  latest              99ec81b80c55        2 weeks ago         266 MB
ubuntu                  trusty              99ec81b80c55        2 weeks ago         266 MB
ubuntu                  13.04               316b678ddf48        2 weeks ago         169.4 MB
ubuntu                  raring              316b678ddf48        2 weeks ago         169.4 MB
busybox                 latest              2d8e5b282c81        2 weeks ago         2.489 MB
ubuntu                  10.04               3db9c44f4520        2 weeks ago         183 MB
ubuntu                  lucid               3db9c44f4520        2 weeks ago         183 MB

以這個為例

這裡的ubuntu是image名稱嗎?(後面解答)

一個image完整的名稱是:

username/image_name:tag

docker整體和Github非常像,image管理也不例外。

其中,如果username沒有寫,則被認為是官方認證過的image。如前面提到,如果tag沒有寫,則被認為tag是lastest

另外,如果username寫了,如 tankywoo/ubuntu,則會在官方index中查詢username為tankywoo的ubuntu倉庫;如果寫的如上

相關推薦

docker學習筆記(五)——Docker常用命令總結

docker學習筆記 docker常用命令總結 1. 開啟/停止/重啟container(start/stop/restart)容器可以通過run新建一個來運行,也可以重新start已經停止的container,但start不能夠再指定容器啟動時運行的指令,因為docker只能有一個前臺進程。容器st

Docker常用命令總結

【常用命令總結】 系統---------------------------------------- systemctl restart docker  &&  docker start  $(docker ps -a -q)  //重啟時直接開啟說有容

Docker新手入門之九:Docker常用命令總結

轉載過程中,圖片丟失,程式碼顯示錯亂。為了更好的學習內容,請訪問原創版本:https://www.missshi.cn/api/view/blog/5a6328ae0a745f6335000009Ps:初次訪問由於js檔案較大,請耐心等候(5s左右)本文總結了Docker相關

docker 常用命令總結

熟悉docker有一段時間了,這裡總結一些命令,忘記的時候可以自己瀏覽。 萬變不離其宗,掌握一門技術,必須先了解其原理,下面來看一張網上到處可見的架構圖。 #mac 下面安裝 brew ca

Docker 常用命令總結

一、Docker 基本概念 docker 主要分為:映象 、倉庫、容器; 映象:Docker映象是用於建立Docker容器模板,Docker映象採用分層結構的好處就是共享資源。; 容器:容器是獨立執行的一個或一組應用,容器 = 映象

Docker 常用命令 總結

常用命令 總結一下常用命令: 其中<>闊起來的引數為必選,[]闊起來為可選 docker version 檢視docker的版本號,包括客戶端、服務端、依賴的Go等docker info 檢視系統(docker)層面資訊,包括管理的images, con

總結docker常用命令

docker 1docker pull 映象 2docker ps -a 檢視所有容器docker image 檢視映象 3docker rm 容器id 刪除容器 docker rm 一次可以指定多個容器,如果希望批量刪除所有已經退出的容器,可以執行如下命令:docker rm -v $(docker

Docker環境運維常用命令總結

用git打包tgz檔案 開啟git bash. 執行命令 tar -zcvf chart.tgz 待打包資料夾 用k8s打包tgz檔案 將本地檔案拷貝到部署k8s的伺服器上(xshell或moban). 用cd 進入指定壓縮資料夾所在目錄。 helm p

docker 開發常用命令總結

Docker 常用命令總結,映象下載,到docker容器建立,常用docker命令的 增刪查 1.映象下載,從hub.docker.com中下載最新版本的postgres docker pull postgres 2.首次啟動一個容器,名稱為-

docker常用命令總結

docker常用命令 一、docker映象操作 1、docker顯示本地下載好的映象: docker images 2、docker下載映象(例如下載ubuntu12.04): docker pull ubuntu:12.04 或者docker pull centos:

Docker常用命令詳解

nbsp 詳解 .cn 本地 test 並且 www 更多 top docker ps 查看當前正在運行的容器 docker ps -a 查看所有容器的狀態 docker start/stop id/name 啟動/停止某個容器 docker attach id 進

Linux常用命令總結

bashrc 命令 配置環境 bit stat 用戶權限 復制 rtu one Linux文件的目錄結構:樹狀結構,/為最高的根目錄 root:root用戶的個人文件夾(家目錄) bin:存放多數用戶可用的命令 boot:存放啟動文件和

yum常用命令總結

yum常用命令總線yum常用命令如下:yum install package1 安裝指定的安裝包package1yum groupinsall group1 安裝程序組group1yum update package1 更新指定程序包package1yum check-update 檢查可更新的程序yum u

初學者:Git常用命令總結

list 解決 狀態 出現 git merge tag git show epo rep git init 在本地新建一個repo,進入一個項目目錄,執行git init,會初始化一個repo,並在當前文件夾下創建一個.git文件夾. git clone

Git常用命令總結【轉】

mda 同時 owa rem resolve fff gin spl 包含 轉自:http://www.cnblogs.com/mengdd/p/4153773.html 查看、添加、提交、刪除、找回,重置修改文件 git help <command> #

mysql常用命令總結

ble 刪除 常用 ima ces prim left 列名 mysq 一、約束操作 增加主鍵約束 alter table 表名 add constraint 約束名 primary key(列名) 增加外鍵約束 alter table 表名 add constrain

Docker 常用命令

docker#------------------------------------------------------------# 運行容器#------------------------------------------------------------# 運行docker# -it表示前端運行

docker常用命令

啟動 查看 tac doc soft container input mage -- docker load參數說明: -i,--input 導入鏡像 docker run參數說明: --name [name] 為容器指定一個名稱 -d, --detach=

vim常用命令總結

format 高亮顯示 body quit 而是 到你 原來 文件 article vim常用命令總結 (轉) 在命令狀態下對當前行用== (連按=兩次), 或對多行用n==(n是自然數)表示自動縮進從當前行起的下面n行。你可以試試把代碼縮進任意打亂再用

npm常用命令總結

安裝目錄 速度 pen http 查看 gist try 時也 end 概述 npm是同node一起安裝的包管理工具。主要用於管理node包,安裝、卸載、更新、查看、搜索、發布等。 由於npm使用國外的服務器進行下載所以速度較慢,可以使用淘寶鏡像cnpm替代。 $ npm