天天看點

Docker指令詳解

[root@ceshi ~]# docker --help

Commands:

    attach   Attach to a running container    # 目前 shell 下 attach 連接配接指定運作鏡像

    build    Build an image from a Dockerfile         # 通過 Dockerfile 定制鏡像

    commit   Create a new image from a container's changes # 送出目前容器為新的鏡像

    cp       Copy files/folders from the containers filesystem to the host path

              # 從容器中拷貝指定檔案或者目錄到主控端中

    create   Create a new container        # 建立一個新的容器,同run,但不啟動容器

    diff     Inspect changes on a container's filesystem   # 檢視 docker 容器變化

    events   Get real time events from the server   # 從 docker 服務擷取容器實時事件

    exec     Run a command in an existing container      # 在已存在的容器上運作指令

    export   Stream the contents of a container as a tar archive  

              # 導出容器的内容流作為一個 tar 歸檔檔案[對應 import ]

    history  Show the history of an image                 # 展示一個鏡像形成曆史

    images   List images                            # 列出系統目前鏡像

    import   Create a new filesystem image from the contents of a tarball 

              # 從tar包中的内容建立一個新的檔案系統映像[對應 export]

    info     Display system-wide information               # 顯示系統相關資訊

    inspect  Return low-level information on a container   # 檢視容器詳細資訊

    kill     Kill a running container                      # kill 指定 docker 容器

    load     Load an image from a tar archive # 從一個tar包中加載一個鏡像[對應 save]

    login    Register or Login to the docker registry server  

              # 注冊或者登陸一個 docker 源伺服器

    logout   Log out from a Docker registry server         # 從目前 Docker registry 退出

    logs     Fetch the logs of a container                 # 輸出目前容器日志資訊

    port     Lookup the public-facing port which is NAT-ed to PRIVATE_PORT

              # 檢視映射端口對應的容器内部源端口

    pause    Pause all processes within a container        # 暫停容器

    ps       List containers                             # 列出容器清單

    pull     Pull an image or a repository from the docker registry server

              # 從docker鏡像源伺服器拉取指定鏡像或者庫鏡像

    push     Push an image or a repository to the docker registry server

              # 推送指定鏡像或者庫鏡像至docker源伺服器

    restart  Restart a running container                   # 重新開機運作的容器

    rm       Remove one or more containers            # 移除一個或者多個容器

    rmi      Remove one or more images                

              # 移除一個或多個鏡像[無容器使用該鏡像才可删除,否則需删除相關容器才可繼續或 -f 強制删除]

    run      Run a command in a new container

              # 建立一個新的容器并運作一個指令

    save     Save an image to a tar archive    # 儲存一個鏡像為一個tar 包[對應 load]

    search   Search for an image on the Docker Hub         # 在 docker hub 中搜尋鏡像

    start    Start a stopped containers                    # 啟動容器

    stop     Stop a running containers                     # 停止容器

    tag      Tag an image into a repository                # 給源中鏡像打标簽

    top      Lookup the running processes of a container   # 檢視容器中運作的程序資訊

    unpause  Unpause a paused container                    # 取消暫停容器

    version  Show the docker version information           # 檢視 docker 版本号

    wait     Block until a container stops, then print its exit code  

              # 截取容器停止時的退出狀态值

Run 'docker COMMAND --help' formore information on a command.

docker option

Usage of docker:

  --api-enable-cors=false                Enable CORS headers in theremote API                      # 遠端 API 中開啟 CORS 頭

  -b, --bridge=""                        Attach containers to apre-existing network bridge         # 橋接網絡

                                           use 'none' todisable container networking

  --bip=""                               Use this CIDRnotation address for the network bridge's IP, not compatible with -b

                                         # 和 -b 選項不相容,具體沒有測試過

  -d, --daemon=false                     Enable daemon mode                                         #daemon 模式

  -D, --debug=false                      Enable debug mode                                          # debug 模式

  --dns=[]                               Force docker touse specific DNS servers                  # 強制 docker 使用指定 dns 伺服器

  --dns-search=[]                        Force Docker to usespecific DNS search domains            # 強制 docker 使用指定 dns 搜尋域

  -e, --exec-driver="native"             Force the docker runtime to use aspecific exec driver     # 強制 docker 運作時使用指定執行驅動器

  --fixed-cidr=""                        IPv4 subnet for fixedIPs (ex: 10.20.0.0/16)

                                           this subnet must be nestedin the bridge subnet (which is defined by -b or --bip)

  -G, --group="docker"                   Group to assign the unixsocket specified by -H when running in daemon mode

                                           use '' (the empty string) to disablesetting of a group

  -g, --graph="/var/lib/docker"          Path to use as the root of the dockerruntime              # 容器運作的根目錄路徑

  -H, --host=[]                          The socket(s) to bindto in daemon mode                    #daemon 模式下 docker 指定綁定方式[tcp or 本地 socket]

                                          specified using one or more tcp://host:port, unix:///path/to/socket,fd://* or fd://socketfd.

  --icc=true                             Enable inter-containercommunication                       # 跨容器通信

  --insecure-registry=[]                 Enable insecure communicationwith specified registries (no certificate verification for HTTPS and enableHTTP fallback) (e.g., localhost:5000 or 10.20.0.0/16)

  --ip="0.0.0.0"                         Default IP address touse when binding container ports     # 指定監聽位址,預設所有ip

  --ip-forward=true                      Enablenet.ipv4.ip_forward                                 # 開啟轉發

  --ip-masq=true                         Enable IP masquerading for bridge's IPrange

  --iptables=true                        Enable Docker'saddition of iptables rules                # 添加對應 iptables 規則

  --mtu=0                                Set thecontainers network MTU                             # 設定網絡 mtu

                                           ifno value is provided: default to the default route MTU or 1500 if no defaultroute is available

  -p,--pidfile="/var/run/docker.pid"   Path to use for daemon PID file                            # 指定 pid 檔案位置

  --registry-mirror=[]                   Specify a preferred Dockerregistry mirror                 

  -s, --storage-driver=""                Force the docker runtime to usea specific storage driver  # 強制 docker 運作時使用指定存儲驅動

  --selinux-enabled=false                Enable selinux support                                     # 開啟 selinux 支援

  --storage-opt=[]                       Set storage driveroptions                                 #設定存儲驅動選項

  --tls=false                            Use TLS; implied by tls-verifyflags                       # 開啟 tls

 --tlscacert="/root/.docker/ca.pem"     Trust only remotes providing a certificatesigned by the CA given here

  --tlscert="/root/.docker/cert.pem"     Path to TLS certificate file                               # tls 證書檔案位置

 --tlskey="/root/.docker/key.pem"       Path to TLS key file                                       # tlskey 檔案位置

  --tlsverify=false                      Use TLS and verify the remote(daemon: verify client, client: verify daemon) # 使用 tls 并确認遠端控制主機

  -v, --version=false                    Print version informationand quit                         # 輸出 docker 版本資訊

本文轉自    OpenStack2015 部落格,原文連結:   http://blog.51cto.com/andyliu/1902786     如需轉載請自行聯系原作者