0

I ran docker run busybox a few times with success.

docker run busybox echo "hello from busybox"

Output:

hello from busybox

docker ps -a shows the following:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                         PORTS               NAMES
59be6eaee13e        busybox             "echo 'hello from bu…"   2 minutes ago       Exited (0) 2 minutes ago                           lucid_ride
2d1a63cfd696        busybox             "echo 'hello from bu…"   4 minutes ago       Exited (0) 4 minutes ago                           quizzical_engelbart
69804c9b7db5        busybox             "echo 'hello from bu…"   49 minutes ago      Exited (0) 49 minutes ago                          focused_clarke
65c371540c5d        busybox             "echo 'hello from bu…"   59 minutes ago      Exited (0) 59 minutes ago                          charming_merkle
2fc6bd074048        busybox             "sh"                     About an hour ago   Exited (0) About an hour ago                       nice_noyce

Trying to use either docker run or docker exec with the name in the Names column instead of the imange name busyboxy.

docker run lucid_ride echo "hello from lucid_ride"

Output:

docker: Error response from daemon: pull access denied for lucid_ride, repository does not exist...

Using exec:

docker exec -it lucid_ride echo "hello from lucid_ride" 

Output:

Error response from daemon: Container 59be6eaee13e4089a5abcccee7fa4778f8b76332e15a0dc2f698057c0368f95f is not running

So, I can run docker run busybox all day and have instances show up in the results of the docker ps -a. But, when I try to use any of the names in the Names column (either with exec or run) it doesn't work. Why is this? Thank you.

1 Answer 1

1

Here are a short description of the docker commands above :

  • docker run : starts a docker container from the given image name ;
  • docker exec : runs a program inside a running container;
  • docker start : restart a stopped container by relaunching the initial command;

You should definitivly try the last one ;-)

2
  • Thank you for your response. docker start lucid_ride echo "hello from lucid_ride" produces the following error. I can continuously run busybox with no problem and keep getting new names shown in docker ps -a. But, I cannot start, exec or run any using any of the names (e.g lucid_ride). Jan 26, 2022 at 17:19
  • You juste need to execute "docker start -a lucid_ride" and it will run the echo command again. Jan 26, 2022 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.