[英]Docker container not running after creating with mounted volume
I am trying to use an image that I pulled from the docker database. 我正在尝试使用从docker数据库中提取的图像。 However I need data from the host to use some programs loaded into the image.
但是,我需要来自主机的数据才能使用某些加载到映像中的程序。 I created a container with this
我用这个创建了一个容器
sudo docker run --name="mdrap" -v "/home/ubuntu/profile/reads/SE:/usr/local/src/volume" sigenae/drap
it appears that everything works and then I start the container 看来一切正常,然后我启动容器
sudo docker start mdrap
but when I check the running containers it is not listed there and if I try to load the container into /bin/bash it tells me the container is not running. 但是当我检查正在运行的容器时,该容器未在此处列出,如果我尝试将容器加载到/ bin / bash中,它会告诉我该容器未在运行。 I am a beginner with docker and am only trying to use an image to run programs with all the required dependencies, what am I doing wrong?
我是Docker的初学者,并且仅尝试使用映像来运行具有所有必需依赖项的程序,我在做什么错呢?
docker start
is only to start a stopped container. docker start
仅用于启动已停止的容器。 It's not necessary after a docker run
. 在
docker run
后没有必要。 (but more after a docker **create**
, like in the documentation ) (但在
docker **create**
,更多信息,如文档中所示 )
A container is started as long as it's main process is running. 只要容器的主进程正在运行,它就会启动。
As soon as the main process stops, the container stops. 一旦主过程停止,容器就会停止。
The main process of a container can be either: 容器的主要过程可以是:
ENTRYPOINT
if defined ENTRYPOINT
如果已定义) CMD
if no ENTRYPOINT
and no command line argument ENTRYPOINT
和没有命令行参数, ENTRYPOINT
CMD
In your case, as you don't have any command line argument (after the image name on the docker run
command) and the image only defines a CMD
(= /bin/bash
), your container is trying to start a /bin/bash
. 在您的情况下,由于您没有任何命令行参数(在
docker run
命令上的映像名称之后)并且该映像仅定义了CMD
(= /bin/bash
),因此您的容器正在尝试启动/bin/bash
。
But , as you don't launch the container with the --interactive/-i
nor --tty/-t
(again like in the documentation ), your process as nothing to interact with and stops (idem for each start of this container). 但是 ,由于您没有使用
--interactive/-i
或--tty/-t
启动容器(同样类似于文档中的内容 ),因此您的过程就没有什么可与之交互和停止的(此容器每次启动时--tty/-t
) )。
So your solution is simply to follow the documentation : 因此,您的解决方案只是遵循文档 :
docker create --name drap --privileged -v /home/ubuntu/profile/reads/SE:/usr/local/src/volume -i -t sigenae/drap /bin/bash
docker start drap
docker exec -i -t drap /bin/bash
Or even simpler: 甚至更简单:
docker run --name drap --privileged -v /home/ubuntu/profile/reads/SE:/usr/local/src/volume -i -t sigenae/drap /bin/bash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.