docker 容器 详解

docker run  ## 创建一个新容器

[[email protected] ~]# docker run --help

Usage:    docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

Options:
      --add-host list                  Add a custom host-to-IP mapping (host:ip)
  -a, --attach list                    Attach to STDIN, STDOUT or STDERR
      --blkio-weight uint16            Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
      --blkio-weight-device list       Block IO weight (relative device weight) (default [])
      --cap-add list                   Add Linux capabilities
      --cap-drop list                  Drop Linux capabilities
      --cgroup-parent string           Optional parent cgroup for the container
      --cidfile string                 Write the container ID to the file
      --cpu-period int                 Limit CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int                  Limit CPU CFS (Completely Fair Scheduler) quota
      --cpu-rt-period int              Limit CPU real-time period in microseconds
      --cpu-rt-runtime int             Limit CPU real-time runtime in microseconds
  -c, --cpu-shares int                 CPU shares (relative weight)
      --cpus decimal                   Number of CPUs
      --cpuset-cpus string             CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string             MEMs in which to allow execution (0-3, 0,1)
  -d, --detach                         Run container in background and print container ID
      --detach-keys string             Override the key sequence for detaching a container
      --device list                    Add a host device to the container
      --device-cgroup-rule list        Add a rule to the cgroup allowed devices list
      --device-read-bps list           Limit read rate (bytes per second) from a device (default [])
      --device-read-iops list          Limit read rate (IO per second) from a device (default [])
      --device-write-bps list          Limit write rate (bytes per second) to a device (default [])
      --device-write-iops list         Limit write rate (IO per second) to a device (default [])
      --disable-content-trust          Skip image verification (default true)
      --dns list                       Set custom DNS servers
      --dns-option list                Set DNS options
      --dns-search list                Set custom DNS search domains
      --entrypoint string              Overwrite the default ENTRYPOINT of the image
  -e, --env list                       Set environment variables
      --env-file list                  Read in a file of environment variables
      --expose list                    Expose a port or a range of ports
      --group-add list                 Add additional groups to join
      --health-cmd string              Command to run to check health
      --health-interval duration       Time between running the check (ms|s|m|h) (default 0s)
      --health-retries int             Consecutive failures needed to report unhealthy
      --health-start-period duration   Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s)
      --health-timeout duration        Maximum time to allow one check to run (ms|s|m|h) (default 0s)
      --help                           Print usage
  -h, --hostname string                Container host name
      --init                           Run an init inside the container that forwards signals and reaps processes
  -i, --interactive                    Keep STDIN open even if not attached
      --ip string                      IPv4 address (e.g., 172.30.100.104)
      --ip6 string                     IPv6 address (e.g., 2001:db8::33)
      --ipc string                     IPC mode to use
      --isolation string               Container isolation technology
      --kernel-memory bytes            Kernel memory limit
  -l, --label list                     Set meta data on a container
      --label-file list                Read in a line delimited file of labels
      --link list                      Add link to another container
      --link-local-ip list             Container IPv4/IPv6 link-local addresses
      --log-driver string              Logging driver for the container
      --log-opt list                   Log driver options
      --mac-address string             Container MAC address (e.g., 92:d0:c6:0a:29:33)
  -m, --memory bytes                   Memory limit
      --memory-reservation bytes       Memory soft limit
      --memory-swap bytes              Swap limit equal to memory plus swap: ‘-1‘ to enable unlimited swap
      --memory-swappiness int          Tune container memory swappiness (0 to 100) (default -1)
      --mount mount                    Attach a filesystem mount to the container
      --name string                    Assign a name to the container
      --network string                 Connect a container to a network (default "default")
      --network-alias list             Add network-scoped alias for the container
      --no-healthcheck                 Disable any container-specified HEALTHCHECK
      --oom-kill-disable               Disable OOM Killer
      --oom-score-adj int              Tune host‘s OOM preferences (-1000 to 1000)
      --pid string                     PID namespace to use
      --pids-limit int                 Tune container pids limit (set -1 for unlimited)
      --privileged                     Give extended privileges to this container
  -p, --publish list                   Publish a container‘s port(s) to the host
  -P, --publish-all                    Publish all exposed ports to random ports
      --read-only                      Mount the container‘s root filesystem as read only
      --restart string                 Restart policy to apply when a container exits (default "no")
      --rm                             Automatically remove the container when it exits
      --runtime string                 Runtime to use for this container
      --security-opt list              Security Options
      --shm-size bytes                 Size of /dev/shm
      --sig-proxy                      Proxy received signals to the process (default true)
      --stop-signal string             Signal to stop a container (default "SIGTERM")
      --stop-timeout int               Timeout (in seconds) to stop a container
      --storage-opt list               Storage driver options for the container
      --sysctl map                     Sysctl options (default map[])
      --tmpfs list                     Mount a tmpfs directory
  -t, --tty                            Allocate a pseudo-TTY
      --ulimit ulimit                  Ulimit options (default [])
  -u, --user string                    Username or UID (format: <name|uid>[:<group|gid>])
      --userns string                  User namespace to use
      --uts string                     UTS namespace to use
  -v, --volume list                    Bind mount a volume
      --volume-driver string           Optional volume driver for the container
      --volumes-from list              Mount volumes from the specified container(s)
  -w, --workdir string                 Working directory inside the container

原文地址:https://www.cnblogs.com/carriezhangyan/p/10736400.html

时间: 2024-08-01 20:53:00

docker 容器 详解的相关文章

搭建部署Docker容器详解实操

Docker 容器 :    容器是Docker又一核心的概念,简单来说,容器是独立运行的一个或一组应用,以及它们的运行态环境.对应的,虚拟机可以理解为模拟运行的一整套操作系统(提供了运行态环境和其他系统环境)和跑在上面的应用. 接下来具体介绍如何管理一个容器,包括创建.启动和停止等. 启动容器有两种方式:          (1.) 第一种是基于镜像新建一个容器并启动.   所需要的命令主要为docker run    实例:            -t:让docker分配一个为终端(pase

Docker 容器详解

容器是 Docker 又一核心概念,简单的说,容器是独立运行的一个或一组应用,以及它们的运行态环境.对应的,虚拟机可以理解为模拟运行的一整套操作系统(提供了运行态环境和其他系统环境)和跑在上面的应用. 本章将具体介绍如何来管理一个容器,包括创建.启动和停止等. 启动容器有两种方式,一种是基于镜像新建一个容器并启动,另外一个是将在终止状态(stopped)的容器重新启动. 新建并启动 所需要的命令主要为docker run 下面的命令则启动一个 bash 终端,允许用户进行交互. -t 选项让 D

docker 命令详解

Docker是一个用了一种新颖方式实现的超轻量虚拟机,在实现的原理和应用上还是和VM有巨大差别,专业的叫法是应用容器(Application Container).(我个人还是喜欢称虚拟机) Docker应用容器相对于 VM 有以下几个优点: 启动速度快,容器通常在一秒内可以启动,而 VM 通常要更久 资源利用率高,一台普通PC 可以跑上千个容器,你跑上千个 VM 试试 性能开销小, VM 通常需要额外的 CPU 和内存来完成 OS 的功能,这一部分占据了额外的资源 因为VM 的 Hypervi

Cocos2d-x3.0模版容器详解之三:cocos2d::Value

1.概述 版本: v3.0 beta 语言: C++ 定义在 "COCOS2DX_ROOT/cocos/base" 路径下的 "CCValue.h" 的头文件中. ? 1 class Value; cocos2d::Valie 是一个包含了很多原生类型(int,float,double,bool,unsigned char,char* 和 std::string)外加 std::vector<Value>, std::unordered_map<s

Cocos2d-x3.0模版容器详解之——cocos2d::Vector&lt;T&gt;, cocos2d::Map&lt;K,V&gt;, cocos2d::Value

Cocos2d-x3.0模版容器详解之一:cocos2d::Vector<T>  http://www.cocoachina.com/bbs/read.php?tid=199793Cocos2d-x3.0模版容器详解之二:cocos2d::Map<K,V>  http://www.cocoachina.com/bbs/read.php?tid=199916Cocos2d-x3.0模版容器详解之三:cocos2d::Value  http://www.cocoachina.com/b

Docker网络详解

Docker网络详解 转载请注明来自:http://blog.csdn.net/wsscy2004 网络基础 Docker使用linux桥接,在主机虚拟一个docker0网络接口,在主机中运行命令查看: # List host bridges $ sudo brctl showbridge name bridge id STP enabled interfacesdocker0 8000.000000000000 no # Show docker0 IP address $ sudo ifcon

Docker 架构详解 - 每天5分钟玩转容器技术(7)

Docker 的核心组件包括: Docker 客户端 - Client Docker 服务器 - Docker daemon Docker 镜像 - Image Registry Docker 容器 - Container Docker 架构如下图所示: Docker 采用的是 Client/Server 架构.客户端向服务器发送请求,服务器负责构建.运行和分发容器.客户端和服务器可以运行在同一个 Host 上,客户端也可以通过 socket 或 REST API 与远程的服务器通信. Dock

docker 操作命令详解

docker attach命令-登录一个已经在执行的容器 docker build 命令-建立一个新的image docker commit命令-提交一个新的image docker cp命令-将容器中的文件拷贝到主机上 docker daemon命令-docker运行可指定项详解 docker diff命令-较一个容器不同版本提交的文件差异 docker events命令-获取sever中的实时事件 docker export命令-导出一个容器 docker history命令-显示一个ima

Docker入门详解

目录: Docker介绍 传统虚拟化与容器虚拟化的区别 Container的核心技术及相关概念 安装docker Docker镜像管理 Docker容器管理 Docker网络之端口映射 Docker存储之挂载目录 手动构建一个docker镜像 未完待续... 正文: 一.Docker介绍:   什么是docker?Docker是一个开源项目,诞生于2013年初,最初是dotCloud公司内部的一个业余项目.它基于Google公司推出的Go语言实现.项目后来加入了Linux基金会,遵从了Apach