Reputation: 7141
I run it in detached mode with,
docker run -d busybox:1.24
But it does not show up in docker ps
what is the reason? Should not it be working?
Should i have to pass "running command" like sleep 1000
?
EDIT: Seems like the container stops when there is nothing to run.
Upvotes: 0
Views: 1051
Reputation: 702
Depends on what the CMD directives says in your Dockerfile. If you dont run a script or program that is running continuous the the container will simple end right away.
To see the status of the container: -a shows even exited containers
docker ps -a
To see what happend when it ran
docker logs <container-id>
To run a cmd prompt
docker run -it <container-id> /bin/bash
To run in detached mode you need a script or command that will wait eg:
sleep infinite
Upvotes: 0
Reputation: 1271
When you run docker ps
, you will only see a list of containers that are running.
To see all containers, including ones that are stopped, created, exited, restarting etc, you should use docker ps -a
.
The busybox
container isn’t running anything. So it will just exit as soon as it starts.
If you do docker run -d busybox:1.24 sleep 10
, then run docker ps
, you will see the running container - until the sleep
process exits (after 10 seconds). At which point, you’ll need to use docker ps -a
again.
Upvotes: 1