shelldockerdocker-exec

Docker exec Requires minimum of 2 arguments


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.


Solution

  • 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