0

I am trying to use an image that I pulled from the docker database. 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. 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?

bohawk
  • 61
  • 1
  • 1
  • 9

1 Answers1

0

docker start is only to start a stopped container. It's not necessary after a docker run. (but more after a docker **create**, like in the documentation)

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:

  • the ENTRYPOINT if defined
  • the CMD if no ENTRYPOINT and no command line argument
  • the command line argument

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.
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).

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
zigarn
  • 10,892
  • 2
  • 31
  • 45