如何使用 nohup 让 docker 命令在后台运行 [英] How to get docker commands to run in the background with nohup

查看:474
本文介绍了如何使用 nohup 让 docker 命令在后台运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个 docker 命令:

I'm running a docker command thus:

docker exec -t -i 44a1459f4468 cloudgene run imputationserver@1.4.1 --files /chrX_impute/ALL.chrX.Non.Pseudo.Auto.phase3_v5.shapeit2_mvncall_integrated.noSingleton.genotypes.vcf.gz --refpanel apps@1000g-phase-3-v5@2.0.0 --conf /etc/hadoop/conf --population mixed --mode qconly --output /chrX_impute/ALL.chrX.Non >  ALL.chrX.Non.qc.log 2>&1

使用我从 在 docker not 中重定向 nohup 的输出的建议工作和重定向

但是,当我运行此命令时,它不会在后台运行.

However, when I run this command, it does not run in the background.

https://unix.stackexchange.com/questions/268284/nohup-doesnt-work-as-expected-in-docker-script 听起来好像添加 -t 会使其像 shell 命令一样运行,但是仅适用于 docker run.

https://unix.stackexchange.com/questions/268284/nohup-doesnt-work-as-expected-in-docker-script makes it sound as if adding -t will make it run as if it's a shell command, but that only works with docker run.

如何让这个 docker 命令通过 nohup 运行?

How can I get this docker command to run with nohup?

推荐答案

来自 docker exec 文档页面 https://docs.docker.com/engine/reference/commandline/exec/

From the docker exec documentation page https://docs.docker.com/engine/reference/commandline/exec/

--interactive , -i      Keep STDIN open even if not attached
--tty , -t              Allocate a pseudo-TTY

我想同时删除 -i-t 标志可能就足够了

I guess removing both the -i and -t flags would probably be sufficient

这篇关于如何使用 nohup 让 docker 命令在后台运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆