Docker exec Requires minimum of 2 arguments

user3520669 picture user3520669 · Mar 17, 2016 · Viewed 8.6k times · Source

I am using a shell script on Linux in order to execute some Docker commands :

docker exec -t -i test1 passwd
...
docker exec -t -i test2 passwd

And on the second exec command I receive the following error :

docker: "exec" requires a minimum of 2 arguments.

What am I doing wrong, or what am I missing?

Thank you in advance.

Answer

Harold Castillo picture Harold Castillo · Aug 1, 2017

I have had the same mistake

docker exec -it gallant_bose

C:\Program Files\Docker Toolbox\docker.exe: "exec" requires a minimum of 2 arguments. See 'C:\Program Files\Docker Toolbox\docker.exe exec --help'. Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...] Run a command in a running container

The solution, add the command bash in my case:

$ docker exec -it gallant_bose bash

root@e747ffecc84d:/#

Best wishes!

Update

Also, you can execute docker exec -it gallant_bose /bin/bash for some images