Docker命令集錦-Docker操作命令

1哆姻、Docker操作命令

1.1蚂踊、Docker命令匯總

語法:docker [OPTIONS] COMMAND
選項(xiàng):

選項(xiàng) 英文說明&中文說明
--config string Location of client config files (default "/root/.docker")
客戶端配置文件的位置(默認(rèn)為“/root/.docker”)
-c, --context string Name of the context to use to connect to the daemon(overrides DOCKER_HOST env var and default context set with "docker context use")
用于連接守護(hù)進(jìn)程的上下文的名稱(覆蓋DOCKER_HOST env var和用“docker context use”設(shè)置的默認(rèn)上下文)
-D, --debug Enable debug mode
啟用調(diào)試模式
-H, --host list Daemon socket(s) to connect to
要連接的守護(hù)進(jìn)程套接字
-l, --log-level string Set the logging evel("debug"|"info"|"warn"|"error"|"fatal") (default "info")
設(shè)置日志級別("debug"|"info"|"warn"|"error"|"fatal")(默認(rèn)"info")
--tls Use TLS; implied by --tlsverify
使用TLS;暗示了——tlsverify
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
僅由此CA簽名的信任證書(默認(rèn)為“/root/.docker/ CA .pem”)
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
TLS證書文件的路徑(默認(rèn)為“/root/.docker/cert.pem”)
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
TLS密鑰文件的路徑(默認(rèn)為“/root/.docker/key.pem”)
--tlsverify Use TLS and verify the remote
使用TLS并驗(yàn)證遠(yuǎn)程
-v, --version Print version information and quit
打印版本信息并退出

管理命令:

命令 英文說明&中文說明
builder Manage builds
管理構(gòu)建
config Manage Docker configs
管理Docker配置
container Manage containers
管理容器
context Manage contexts
管理上下文
engine Manage the docker engine
管理Docker引擎
image Manage images
管理鏡像
network Manage networks
管理網(wǎng)絡(luò)
node Manage Swarm nodes
管理集群節(jié)點(diǎn)
plugin Manage plugins
管理插件
secret Manage Docker secrets
管理Docker的加密
service Manage services
管理服務(wù)
stack Manage Docker stacks
管理Docker棧
swarm Manage Swarm
管理集群
system Manage Docker
管理Docker
trust Manage trust on Docker images
管理Docker鏡像的信任
volume Manage volumes
管理卷

命令:

命令 英文說明&中文說明
attach Attach local standard input, output, and error streams to a running container
將本地標(biāo)準(zhǔn)輸入、輸出和錯(cuò)誤流附加到正在運(yùn)行的容器中
build Build an image from a Dockerfile
從Dockerfile構(gòu)建一個(gè)映像
commit Create a new image from a container's changes
根據(jù)容器的更改創(chuàng)建新映像
cp Copy files/folders between a container and the local filesystem
在容器和本地文件系統(tǒng)之間復(fù)制文件/文件夾
create Create a new container
創(chuàng)建一個(gè)新容器
diff Inspect changes to files or directories on a container's filesystem
檢查容器文件系統(tǒng)中文件或目錄的更改
events Get real time events from the server
從服務(wù)器獲取實(shí)時(shí)事件
exec Run a command in a running container
在正在運(yùn)行的容器中運(yùn)行命令
export Export a container's filesystem as a tar archive
將容器的文件系統(tǒng)導(dǎo)出為tar歸檔文件
history Show the history of an image
顯示鏡像的構(gòu)建歷史
images List images
鏡像列表
import Import the contents from a tarball to create a filesystem image
從tarball導(dǎo)入內(nèi)容以創(chuàng)建文件系統(tǒng)映像
info Display system-wide information
顯示整個(gè)系統(tǒng)的信息
inspect Return low-level information on Docker objects
返回Docker對象的低級信息
kill Kill one or more running containers
殺死一個(gè)或多個(gè)正在運(yùn)行的容器
load Load an image from a tar archive or STDIN
從tar存檔或STDIN加載鏡像
login Log in to a Docker registry
登錄到Docker registry
logout Log out from a Docker registry
從Docker registry注銷
logs Fetch the logs of a container
獲取容器的日志
pause Pause all processes within one or more containers
暫停一個(gè)或多個(gè)容器中的所有進(jìn)程
port List port mappings or a specific mapping for the container
列出端口映射或容器的特定映射
ps List containers
容器列表
pull Pull an image or a repository from a registry
從registry中提取鏡像或存儲(chǔ)庫
push Push an image or a repository to a registry
將映像或存儲(chǔ)庫推入registry
rename Rename a container
容器重命名
restart Restart one or more containers
重啟一個(gè)或多個(gè)容器
rm Remove one or more containers
移除一個(gè)或多個(gè)容器
rmi Remove one or more images
移除一個(gè)或多個(gè)鏡像
run Run a command in a new container
在新容器中運(yùn)行命令
save Save one or more images to a tar archive (streamed to STDOUT by default)
將一個(gè)或多個(gè)鏡像保存到tar存檔(默認(rèn)情況下流到STDOUT)
search Search the Docker Hub for images
在Docker Hub中搜索鏡像
start Start one or more stopped containers
啟動(dòng)一個(gè)或多個(gè)停止的容器
stats Display a live stream of container(s) resource usage statistics
顯示容器資源使用統(tǒng)計(jì)信息的實(shí)時(shí)流
stop Stop one or more running containers
停止一個(gè)或多個(gè)正在運(yùn)行的容器
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
創(chuàng)建一個(gè)引用源鏡像的目標(biāo)鏡像標(biāo)記
top Display the running processes of a container
顯示容器的運(yùn)行進(jìn)程
unpause Unpause all processes within one or more containers
在一個(gè)或多個(gè)容器中暫停所有進(jìn)程
update Update configuration of one or more containers
更新一個(gè)或多個(gè)容器的配置
version Show the Docker version information
顯示Docker版本信息
wait Block until one or more containers stop, then print their exit codes
阻塞寺旺,直到一個(gè)或多個(gè)容器停止透乾,然后打印它們的退出代碼
1.2噪猾、搜索鏡像命令

語法: docker search [OPTIONS] TERM
選項(xiàng):

選項(xiàng) 英文說明 中文說明
-f, --filter filter Filter output based on conditions provided 根據(jù)提供的條件過濾輸出
--format string Pretty-print search using a Go template 使用Go模板進(jìn)行漂亮的打印搜索
--limit int Max number of search results (default 25) 最多搜尋結(jié)果數(shù)目(預(yù)設(shè)25個(gè))
--no-trunc Don't truncate output 不截?cái)噍敵?/td>
[root@Server ~]# docker search centos
NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
centos                             The official build of CentOS.                   5945                [OK]  
ansible/centos7-ansible            Ansible on Centos7                              128                                     [OK]
consol/centos-xfce-vnc             Centos container with "headless" VNC session…   114                                     [OK]
jdeathe/centos-ssh                 OpenSSH / Supervisor / EPEL/IUS/SCL Repos - …   114                                     [OK]
centos/mysql-57-centos7            MySQL 5.7 SQL database server                   74                        
imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              58                                      [OK]
tutum/centos                       Simple CentOS docker image with SSH access      45                        
centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relational …   43                        
kinogmt/centos-ssh                 CentOS with SSH                                 29                                      [OK]
pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag names…   11                        
guyton/centos6                     From official centos6 container with full up…   10                                      [OK]
drecom/centos-ruby                 centos ruby                                     6                                       [OK]
centos/tools                       Docker image that has systems administration…   6                                       [OK]
pivotaldata/centos                 Base centos, freshened up a little with a Do…   4                         
pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile t…   3                         
pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated wi…   3                         
mamohr/centos-java                 Oracle Java 8 Docker image based on Centos 7    3                                       [OK]
darksheer/centos                   Base Centos Image -- Updated hourly             3                                       [OK]
miko2u/centos6                     CentOS6 日本語環(huán)境                               2                                       [OK]
mcnaughton/centos-base             centos base image                               1                                       [OK]
blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                                       [OK]
indigo/centos-maven                Vanilla CentOS 7 with Oracle Java Developmen…   1                                       [OK]
pivotaldata/centos7-dev            CentosOS 7 image for GPDB development           0                         
smartentry/centos                  centos with smartentry                          0                                       [OK]
pivotaldata/centos6.8-dev          CentosOS 6.8 image for GPDB development         0  
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市轻姿,隨后出現(xiàn)的幾起案子犁珠,更是在濱河造成了極大的恐慌,老刑警劉巖互亮,帶你破解...
    沈念sama閱讀 219,110評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件犁享,死亡現(xiàn)場離奇詭異,居然都是意外死亡豹休,警方通過查閱死者的電腦和手機(jī)炊昆,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,443評論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來威根,“玉大人凤巨,你說我怎么就攤上這事÷宀螅” “怎么了敢茁?”我有些...
    開封第一講書人閱讀 165,474評論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長留美。 經(jīng)常有香客問我彰檬,道長,這世上最難降的妖魔是什么谎砾? 我笑而不...
    開封第一講書人閱讀 58,881評論 1 295
  • 正文 為了忘掉前任逢倍,我火速辦了婚禮,結(jié)果婚禮上景图,老公的妹妹穿的比我還像新娘较雕。我一直安慰自己,他們只是感情好症歇,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,902評論 6 392
  • 文/花漫 我一把揭開白布郎笆。 她就那樣靜靜地躺著,像睡著了一般忘晤。 火紅的嫁衣襯著肌膚如雪宛蚓。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,698評論 1 305
  • 那天设塔,我揣著相機(jī)與錄音凄吏,去河邊找鬼。 笑死闰蛔,一個(gè)胖子當(dāng)著我的面吹牛痕钢,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播序六,決...
    沈念sama閱讀 40,418評論 3 419
  • 文/蒼蘭香墨 我猛地睜開眼任连,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了例诀?” 一聲冷哼從身側(cè)響起随抠,我...
    開封第一講書人閱讀 39,332評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎繁涂,沒想到半個(gè)月后拱她,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,796評論 1 316
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡扔罪,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,968評論 3 337
  • 正文 我和宋清朗相戀三年秉沼,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片矿酵。...
    茶點(diǎn)故事閱讀 40,110評論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡唬复,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出坏瘩,到底是詐尸還是另有隱情盅抚,我是刑警寧澤,帶...
    沈念sama閱讀 35,792評論 5 346
  • 正文 年R本政府宣布倔矾,位于F島的核電站妄均,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏哪自。R本人自食惡果不足惜丰包,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,455評論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望壤巷。 院中可真熱鬧邑彪,春花似錦、人聲如沸胧华。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,003評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至有巧,卻和暖如春释漆,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背篮迎。 一陣腳步聲響...
    開封第一講書人閱讀 33,130評論 1 272
  • 我被黑心中介騙來泰國打工男图, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人甜橱。 一個(gè)月前我還...
    沈念sama閱讀 48,348評論 3 373
  • 正文 我出身青樓逊笆,卻偏偏與公主長得像,于是被迫代替她去往敵國和親岂傲。 傳聞我的和親對象是個(gè)殘疾皇子难裆,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,047評論 2 355

推薦閱讀更多精彩內(nèi)容