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".
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
In my case, it solved starting the container again, as easy as it may sound.
docker ps -a
(column "NAMES") if you do not know it; in your case it is known: "hb".docker start hb
.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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.