Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker start <container ID> doesn't do anything

Tags:

docker

If I spin up a Docker container with:

docker run -it ubuntu /bin/bash

and then exit. I can see the container using

docker ps -a

However, if I try and restart the container with

docker start <container ID>

I just get echoed back and returned to the command prompt.

What am I missing?

like image 647
Snowcrash Avatar asked Oct 06 '16 17:10

Snowcrash


2 Answers

After running docker start <container ID> to restart the container try running a docker ps to ensure it's actually running.

If it IS running and you want to run commands on a bash shell from within the container, you can run the below command. In your case it would be :

docker exec -it <container ID> bash

like image 147
Fabian Avatar answered Oct 04 '22 08:10

Fabian


use docker start with '-ai' so it attaches to container interactively

docker start -ai <container ID>

CAUTION! This will relaunch the process that this container is supposed to run:

  • If it is defined by a Dockerfile with a CMD instruction, then it will run it.
  • If it was a container for building a Dockerfile, the last failed instruction will be retried.
like image 37
VenkatC Avatar answered Oct 04 '22 08:10

VenkatC