Docker系列(三) Docker run 参数详情

本文详细介绍了Docker run命令的参数使用,包括设置CPU权重、内存限制、容器ID写入文件、后台运行、指定DNS、定义环境变量、挂载卷等,以及如何创建和附加到容器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

docker run 的参数详情

$ sudo docker run

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

Run a command in a new container

一、参数

-a, --attach=[] Attach to stdin, stdout or stderr.
-c, --cpu-shares=0 CPU shares (relative weight) ---------------------# 设置cpu使用权重
–cidfile="" Write the container ID to the file ------------------------ # 把容器id写入到指定文件
–cpuset="" CPUs in which to allow execution (0-3, 0,1) ----------------- # cpu绑定
-d, --detach=false Detached mode: Run container in the background, print new container id -----# 后台运行容器
–dns=[] Set custom dns servers ---------------- # 设置dns
–dns-search=[] Set custom dns search domains -------------- # 设置dns域搜索
-e, --env=[] Set environment variables ---------------- # 定义环境变量
–entrypoint="" Overwrite the default entrypoint of the image
–env-file=[] Read in a line delimited file of ENV variables ----- # 从指定文件读取变量值

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值