Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error response from daemon: Container CONTAINER_NAME is not running

I have a docker image dajobe/hbase and its been built from Ubuntu. I created a container of this image and named it hb.

$ docker run -d --name hb dajobe/hbase
e1f68ff8b3b6c5e474426e2566f8c087d6a785fc5eeb58cd2aeb86176068651d

I then started the /bin/bash on hb, and checked for the availability of the vi editor.

$ docker exec -it hb /bin/bash
root@e1f68ff8b3b6:/# vi
bash: vi: command not found

I then installed vi editor using apt-get

# apt-get install vim
Reading package lists...
DoneBuilding dependency tree
Reading state information... Done
.....
.....

I wanted to commit the changes so that vi editor could persist.

$ docker commit hb dajobe/hbase
1be196188efc5a52562dc8ee1b63d0fd560ea163c49331c10dc435848d75ef64

then, when i again started dajobe/hbase, it automatically stopped.

$ docker run -d --name hb dajobe/hbase
c3e7b9f48077ef854efc6f9bab5e85986e265c98de5423bece0000c973206c38

$ docker exec -it hb /bin/bash
FATA[0000] Error response from daemon: Container hb is not running

Why is the container not running ?

$ docker ps -a
CONTAINER ID        IMAGE              COMMAND          CREATED                   STATUS                 PORTS      NAMES
c3e7b9f48077 dajobe/hbase:latest "/opt/hbase-server"  11 secs ago         Exited (0) 8 secs ago                      hb

Why is the status "Exited" ? Before committing, this wasn't the case, the status was "Up".

like image 379
Aaquib Khwaja Avatar asked Mar 19 '15 12:03

Aaquib Khwaja


People also ask

How do I run a container that is not running?

By default, docker container will exit immediately if you do not have any task running on the container. To keep the container running in the background, try to run it with --detach (or -d ) argument.

How do you check if a container is running or not?

The status of individual containers is accessed via the docker ps command. This emits a table containing the details of all currently running containers. Now the output will be filtered to show the container you've selected. There'll be no records if the container isn't running.

How do I know if docker is running?

The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command. You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker or sudo service docker status , or checking the service status using Windows utilities.

How do I keep a docker container from running?

Dockerfile Command to Keep the Container Running Method 1: You can use the -t (pseudo-tty) docker parameter to keep the container running. Method 2: You can run the container directly passing the tail command via arguments as shown below. Method 3: Another method is to execute a sleep command to infinity.


2 Answers

I would expect the status to be Exited. Perhaps the original image you were using had an ENTRYPOINT that did something that kept the container running while you exec'ed to it. You can try this:

docker run -d --name hb dajobe/hbase sleep 60

Then try your exec, for the next 60 seconds you will connect with your interactive shell. After that, you will get the same message again.

The -d makes the container a daemon. It needs something to do, though, otherwise it just exits! Have you tried just doing the run line with the -it?

docker run -it --name hb dajobe/hbase bash

You get a shell prompt there, too, where you can make your updates to the image.

-g

like image 193
Greg Avatar answered Sep 19 '22 15:09

Greg


In my case, it solved starting the container again, as easy as it may sound.

  • Search for the container name with docker ps -a (column "NAMES") if you do not know it; in your case it is known: "hb".
  • Then docker start hb.
  • Then docker exec -it hb /bin/bash.

You have used run and not start when you wanted to start an already existing but exited container. I do not see any start in your commands.

then, when i again started dajobe/hbase, it automatically stopped.

$ docker run -d --name hb dajobe/hbase c3e7b9f48077ef854efc6f9bab5e85986e265c98de5423bece0000c973206c38

$ docker exec -it hb /bin/bash FATA[0000] Error response from daemon: Container hb is not running

like image 25
questionto42standswithUkraine Avatar answered Sep 17 '22 15:09

questionto42standswithUkraine