Error response from daemon: Container CONTAINER_NAME is not running
Asked Answered
L

3

17

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

Lupulin answered 19/3, 2015 at 12:37 Comment(4)
Check with the command docker events the reason, see the doc docs.docker.com/reference/commandline/cli/#events, for example docker events --filter container=c3e7b9f48077Centaury
nothing happens with this command.. i run the command, and then nothing happens, I need to do a Ctrl+C to stop.Lupulin
just docker events should enlight usCentaury
I have figured out what is happening here. Actually the command /opt/hbase-server is getting failed, but i don't know why ? it was working perfectly with the original image.Lupulin
P
5

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

Petaloid answered 19/3, 2015 at 13:17 Comment(2)
Yes, you are right, sleep 60 allows the container to be active for 60 secs.. Actually, sleep 60 is overriding the original command /opt/hbase-server. But why is the hbase-server exiting when i'm trying with the new image ? it was perfectly working with the original one. Wouldn't the original image and the new image(committed) be same ?, apart from the fact that the committed one would have vim installed on it.Lupulin
I don't know how a newly committed image gets its ENTRYPOINT. The documentation: docs.docker.com/reference/commandline/cli/#commit suggests that you should use a Dockerfile to maintain your image rather than doing it interactively. Then you would have explicit control. I don't know what should be expected when a running image is suspended and saved to a new image.Petaloid
A
3

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

Aleece answered 28/1, 2021 at 23:27 Comment(0)
I
0

I also face the same as you to run the couchdb bash command

docker exec -it my-couchdb bash
and
docker exec -it my-couchdb /opt/couchdb/bin/remsh

Error message:

Error response from daemon: Container 54ca56353e3839ff0b824cf5468973aff021d14ad6b2531b85a1b95437b2ae13 is not running

For me the solution was... I did the all kind of setup whenever I have created the container

Command:

docker run -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password --publish=5984:5984 --name my-couchdb --volume=$HOME/Desktop/BigData/docker-couchdb/data:/opt/couchdb/etc/local.d -d couchdb

If someone face the same problem as mine then try first others solution and if all of the others solution not work then please try once mine, hope it will work finally.

Intermittent answered 20/12, 2021 at 15:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.