Docker container only lasted for 5 seconds? - docker

So there's tutorial about installing Zenko which uses docker.
At step 5, after starting docker container, I checked its exist by using docker ps and found out it disappeared after few seconds.
Not sure what happened. Some one please help me!
[centos#ip-10-0-7-40 ~]$ docker run -d --rm --name s3server -p 8000:8000 -v /home/centos/.aws/credentials:/root/.aws/credentials -v /home/centos/locationConfig.json:/usr/src/app/locationConfig.json -v /home/centos/config.json:/usr/src/app/config.json -e S3DATA=multiple s3server.custom:1.0
93345a2a3813638bf3bcd984978b7b5ad706b6d15955f0d49269579931d8251d
[centos#ip-10-0-7-40 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
93345a2a3813 s3server.custom:1.0 “/usr/src/app/docker…” 2 seconds ago Up 2 seconds 0.0.0.0:8000->8000/tcp s3server
[centos#ip-10-0-7-40 ~]$ docker logs 93345a2a3813
Error response from daemon: No such container: 93345a2a3813

Related

What does COMMAND in 'docker ps' mean?

docker ps or docker container ls returns an overview of all running containers. The meaning of all columns is clear to me, except one. What does the column 'COMMAND' mean?
This is the command which is passed to the container.
$ docker run -d busybox top
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3eca7c034b21 busybox "top" 6 seconds ago Up 5 seconds recursing_dirac
If you check above, top is the command which has been passed to the busybox container and that's what it's showing in the docker ps -a.
It's the command passed to docker run <image> [command].
$ docker run -d ubuntu sleep 60
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS
f0c9cd92a938 ubuntu "sleep 60" 3 seconds ago Up 1 second
If no command was specified there then it's the CMD from the Dockerfile. In ubuntu's case that would be CMD ["/bin/bash"]:
$ docker run -di ubuntu
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS
9cd752ee86f4 ubuntu "/bin/bash" 4 seconds ago Up 2 seconds

docker port command returning nothing

I am following the tutorial here.
In this, you launch a container like so :
docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site
e61d12292d69556eabe2a44c16cbd54486b2527e2ce4f95438e504afb7b02810
which I have done. Then it tells you to run the command :
docker port static-site
This is meant to return the ports the container is running on, right ?
It's returning nothing for me. How come ?
sudo docker ps -l shows it has been created.
Thanks a lot.
On MacOS, I have following results:
$ docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site
ac25e7cdd81725dfa157ff7027d1ed6beb3839c9457b9627728d700375e7a77f
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ac25e7cdd817 dockersamples/static-site "/bin/sh -c 'cd /usr…" 6 seconds ago Up 5 seconds 0.0.0.0:32774->80/tcp, 0.0.0.0:32773->443/tcp static-site
$ docker port static-site
443/tcp -> 0.0.0.0:32773
80/tcp -> 0.0.0.0:32774
Please inspect the result of the column 'ports' of the command docker ps on your machine where ports and the mapped ports are also displayed.

"docker run -d-p " return a sha256 code,but "docker ps": nothing,and docker logs :noting

I run in my terminal:
docker run -d -p 8082:80 --name runoob-nginx-test-web -v ~/nginx/www:/usr/share/nginx/html -v ~/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v ~/nginx/logs:/var/log/nginx matt18/nginx:v1
and get a sha256 code:
072841edf0324c13939e0e95b2119f386414facd124a32de031161f21f498265
but
docker ps : get nothing
docker ps -a : contrainer ID: 072841edf032, STATUS: Exited (0) About a minute ago
docker logs 072841edf032 : get nothing
what is the problem?
would you please check this directory ~/nginx/conf/nginx.conf if it is empty that means nginx service cannot find its config file and exit.

CKAN Docker container not running

I am running the example installation using docker container from the CKAN site. A clean run, that downloads fresh (no local images) gives no errors
docker run -d --name db ckan/postgresql
docker run -d --name solr ckan/solr
docker run -d -p 80:80 --link db:db --link solr:solr ckan/ckan
but then a "docker ps" does not have the ckan image running ...
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
90c6e6a77b0a ckan/solr:latest "java -jar start.jar 15 minutes ago Up 15 minutes 8983/tcp solr
53f9a9f5c145 ckan/postgresql:latest "/usr/local/bin/run" 20 minutes ago Up 20 minutes 5432/tcp db
Where would errors show?
docker ps only lists running containers. You have to pass in the -a option in order to list all containers you have run
docker ps -a
Find the right container and run the following command to see any error messages it may have reported before shutting down
docker logs <container_id>
As at March 6 2015 described at https://github.com/ckan/ckan/issues/2255
ensure that you have killed off any solr containers still running using
docker rm <idnumber>
then use the more recent schema config
wget https://github.com/ckan/ckan/blob/master/ckan/config/solr/schema.xml
docker run -d --name solr -v `pwd`/schema.xml:/opt/solr/example/solr/ckan/conf/schema.xml ckan/solr
then repeat the original failing step:
docker run -d -p 80:80 --link db:db --link solr:solr ckan/ckan
-- EDIT -- This looks like it works but it introduces other problems.
Am going to experiment with suggestion to use https://github.com/datacats/datacats

How to start a docker container (ubuntu image)

How to stat a docker container. I had created it using
docker run -d -P -v /Users/bsr:/usr/local/users --name test ubuntu
I do have virtual box guest addition installed, and mounting works. But, I am not sure why I can't I keep the shell running.
bsr[~/tmp/web] $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cf620ff6c36a ubuntu:latest "/bin/bash" 2 hours ago Exited (0) 2 minutes ago test
8213c8d49842 nginx:latest "nginx" 3 hours ago Up About an hour 0.0.0.0:49154->80/tcp web
bsr[~/tmp/web] $ docker start test
test
bsr[~/tmp/web] $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cf620ff6c36a ubuntu:latest "/bin/bash" 2 hours ago Exited (0) 2 seconds ago test
8213c8d49842 nginx:latest "nginx" 3 hours ago Up About an hour 0.0.0.0:49154->80/tcp web
bsr[~/tmp/web] $
Edit:
it may be because the command (/bin/bash ??) finishes immediately. When I tried,
docker run -d -P -v /Users/bsr:/usr/local/users --name test5 ubuntu /bin/bash -c "while true; do echo Hello world; sleep 1; done"
I could get the terminal. But isn't there any way to just start a container and get to the terminal ??
If you want to run an interactive process, you should use the -i (keep stdin open in case you detach) and -t (allocate a pseudo-tty) flags:
docker run -it ubuntu
You can look at the docs for more information on those flags and their usage.
You can start by using simple command.
docker run "CONTAINER_ID"

Resources