Docker Run 命令

2023-05-16

docker run 参数:
-e :向容器内传递环境变量,启动容器时用户可以动态传参
-v : 挂载文件,把该容器的数据保存到挂载文件上
-p : 端口映射(-p 8888:3306, 8888宿主机的端口8888端口映射到容器的3306端口上)
-d : 后台运行
-i : 以交互模式运行容器,通常与 -t 同时使用
-t : 为容器重新分配一个伪输入终端,通常与 -i 同时使用
–name=“name” : 为容器指定一个名称
-m : 容器使用内存最大值
-v : 绑定一个卷

Docker Run 高阶参数
https://blog.51cto.com/u_15127640/4191714


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
      --cgroupns string                Cgroup namespace to use (host|private)
                                       'host':    Run the container in the Docker host's cgroup namespace
                                       'private': Run the container in its own private cgroup namespace
                                       '':        Use the cgroup namespace as configured by the
                                                  default-cgroupns-mode option on the daemon (default)
      --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
      --domainname string              Container NIS domain name
      --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
      --gpus gpu-request               GPU devices to add to the container ('all' to pass all GPUs)
      --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 network                Connect a container to a network
      --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)
      --platform string                Set platform if server is multi-platform capable
      --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
      --pull string                    Pull image before running ("always"|"missing"|"never") (default "missing")
      --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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Docker Run 命令 的相关文章

随机推荐

  • Kendryte K210 在freertos上的lcd屏幕的使用

    K210上的lcd的屏幕为8位的spi并行接口 使用的屏幕开发板的型号为JLT32009A 某宝应该是可以买到的 需要注意的是若在某宝买的这种屏幕 一般会有8位和16位的区别 商家会告诉你这是两个不一样的屏 但是通过我们查看屏幕的规格书会发
  • Gamma分布、Beta分布、Dirichlet分布

    函数 函数是阶乘在实数上的推广 xff0c 定义为 xff1a x 61 43 0 t x 1 e t d t 函数的性质 xff1a x 43 1 61 x x
  • 消息队列OSQCreate失败:Assertion "OSQCreate" failed at line 71 in ..\LWIP\arch\sys_arch.c错误解决方法

    在STM32F407的上移植正点原子例程中的ucosII和LWIP功能时 xff0c 发现其他任务中创建其他消息邮箱后 xff0c 出现了如下的错误 xff1a Assertion OSQCreate failed at line 67 i
  • 学习Linux 编程的几本好书

    这次涉及到了具体的平台 GNU Linux Linux下开发与明显不同于Windows平台的特点 xff0c 从开发工具到项目组织 xff0c 都有较大的差距 首先声明 xff0c 在做Linux平台开发之前 xff0c 首先要熟练使用Li
  • http parser库的使用方法

    include 34 http parser h 34 include lt stdio h gt include lt stdlib h gt include lt string h gt include lt assert h gt i
  • PIXhawk4飞控学习笔记(一)开发环境

    PIXhawk4飞控学习笔记 xff08 一 xff09 开发环境 PIX4简介开发环境准备PIX4控制板MDK Keil5STM32CUBEMAXQGroundControl地面站 总结 PIX4简介 PX4是Dronecode平台的一部
  • Git常用命令

    1 Git全局设置 当安装Git后首先要做的事情是设置用户名称和email地址 这是非常重要的 xff0c 因为每次Git提交都会使用该用户信息 在Git 命令行中执行下面命令 xff1a 设置用户信息 git config global
  • 在PX4下更换pixhawk的IMU

    写在前面 出于一些原因 xff0c 这篇文章不给出具体的源码 xff0c 因此博主试着将这篇写成了一篇科普性质的文章 xff0c 如果你认真读的话 xff0c 应该会有收获的 为什么要更换pixhawk的传感器 xff1f 大多数的玩家拿到
  • 存储卡插上电脑时显示文件名变乱码请问怎样才能修复???

    存储卡在使用的过程中会出现各种奇怪的错误 xff0c 比如小编今天碰到的一个 xff0c 打开分区提示文件名变乱码 xff01 存储卡插上电脑时显示文件名变乱码请问怎样才能修复 存储卡在使用的过程中会出现各种奇怪的错误 xff0c 比如小编
  • putty使用python模块tkinter显示对话框出现_tkinter.TclError: no display name and no $DISPLAY environment variable

    问题描述 xff1a putty不能显示对话框 出现错误提示 xff1a tkinter TclError no display name and no DISPLAY environment variable 解决办法 xff1a 下载安
  • 有关于ValueError: Variable rnn/basic_lstm_cell/kernel already exists, disallowed.的问题

    很简单 xff0c 重新跑一篇程序 xff0c 我理解为重启核 xff1f xff1f xff1f jupyter中有kernel选项 xff0c 点击选择 Restart amp RunAll xff0c 即可解决问题 Mark
  • 从尾到头打印链表

    题目描述 xff1a 输入一个链表 xff0c 按链表值从尾到头的顺序返回一个ArrayList 分析 xff1a 1 xff0c 新建两个arraylist xff0c 2 xff0c 遍历链表 xff0c 存入第一个arraylist
  • Win10的Linux子系统Ubuntu安装图形界面

    Win10 的 Linux 子系统 Ubuntu 安装图形界面 陈拓 2021 07 25 2021 07 26 1 概述 Win10的linux子系统Windows Subsystem for Linux xff08 简称 WSL xff
  • 得到斐波那契数列的第n个数

    题目 xff1a 现在要求输入一个整数n xff0c 请你输出斐波那契数列的第n项 xff08 从0开始 xff0c 第0项为0 xff09 n lt 61 39 分析 xff1a 1 xff0c 1 xff0c 2 xff0c 3 xff
  • ModuleNotFoundError: No module named 'scipy._lib.decorator'问题解决

    问题来源 xff1a 在导入sklearn库时 xff0c 出现 usr lib python3 dist packages scipy sparse linalg isolve iterative py in 8 9 from scipy
  • 二叉搜索树的后序遍历序列

    题目 输入一个整数数组 xff0c 判断该数组是不是某二叉搜索树的后序遍历的结果 如果是则输出Yes 否则输出No 假设输入的数组的任意两个数字都互不相同 分析 碰到二叉树 xff0c 优先想递归 这里 xff0c 后序数组 xff0c 最
  • 二叉树中和为某一值的路径

    题目 输入一颗二叉树的跟节点和一个整数 xff0c 打印出二叉树中结点值的和为输入整数的所有路径 路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径 注意 在返回值的list中 xff0c 数组长度大的数组靠前 分析 二叉树
  • 复杂链表的复制(java)

    题目 输入一个复杂链表 xff08 每个节点中有节点值 xff0c 以及两个指针 xff0c 一个指向下一个节点 xff0c 另一个特殊指针指向任意一个节点 xff09 xff0c 返回结果为复制后复杂链表的head xff08 注意 xf
  • CMake学习-添加头文件路径,库路径,库

    CMake中 xff0c 添加头文件路径 xff0c 对应的函数叫include directories 然后在参数中 xff0c 把所有需要添加的路径 xff0c 加进去就可以了 添加库路径 xff0c 对应的函数叫LINK DIRECT
  • Docker Run 命令

    docker run 参数 xff1a e xff1a 向容器内传递环境变量 xff0c 启动容器时用户可以动态传参 v 挂载文件 xff0c 把该容器的数据保存到挂载文件上 p 端口映射 xff08 p 8888 3306 8888宿主机