使用-d选项后,容器会在后台运行,并输出容器ID,我们可以使用docker logs [containerID]来查看容器的输出结果。如果想跟容器进行交互,可以使用docker exec -it [container ID] /bin/bash来操作。 需要注意的是,容器是否会持久运行,和-d选项无关。关于这一点,在文章docker run 如何让容器启动后不会自动停止中有介绍。
1. 原文标题:Run Docker Container in Background (Detached Mode),作者:Aaron Kili 【51CTO译稿,合作站点转载请注明原文译者和出处为51CTO.com】
Docker run(运行Container) 常用选项: -d Run container in background and print container ID -p Publish a container's port(s) to the host ( container和host端口映射) -i 以交互模式运行容器,通常与 -t 同时使用 -t 为容器重新分配一个伪输入终端,通常与 -i 同时使用 --name="nginx-lb" 为容器指...
为了简化,建议将 workspace 文件夹路径在宿主机和容器上配置为一致的,比如将`workspace_dir_host`和`workspace_dir_container`都配置为`/siyuan/workspace`,对应的启动命令示例: ``` docker run -v /siyuan/workspace:/siyuan/workspace -p 6806:6806 -u 1000:1000 b3log/siyuan --workspace=/siyuan/workspace/ ...
--cpuset-cpus CPUs in which to allow execution (0-3, 0,1) --cpuset-mems MEMs in which to allow execution (0-3, 0,1) -d, --detach Run container in background and print container ID --detach-keys Override the key sequence for detaching a container --device Add a host device to ...
➜ ~ docker run -d nginx 然后满怀期望等待奇迹发生,结果看到输出 f021105c2da60f1f3930070e917668c7ffcabc45e2cf64c622a2d68f216d0c2b 注意 -d, --detach Run container in background and print container ID 然后我们发现系统里面多了一个nginx容器,这个过程的背后究竟发生了什么?我们来一探究竟 ...
--cpuset-mems MEMs in which to allow execution (0-3, 0,1) -d, --detach Run container in background and print container ID --detach-keys Override the key sequence for detaching a container --device Add a host device to the container --device-cgroup-rule Add a rule to the cgroup all...
描述(英文):Run a command in a new container 描述(中文):在新容器中运行命令 语法:docker container run [OPTIONS] IMAGE [COMMAND] [ARG...] 选项: 选项英文说明&中文说明 --add-host listAdd a custom host-to-IP mapping (host:ip) 添加自定义主机到ip的映射(主机:ip) ...
Docker is a platform for developers and sysadmins to**build,run,and share**applications with containers.The use of containers to deploy applications is called*containerization*.Containers are not new,but their use for easily deploying applications is. ...
PS:针对纯操作系统镜像(没有守护进程的)在docker run的时候需要加-it参数,否则启动后会自动退出 -d, --detach Run container in background and print container ID 让容器在后台运行并打印容器的ID。如果你的容器启动会打印日志,那边加-d选项在终端就看不到了,需要用docker logs -f 容器ID查看...