Docker exec Requires minimum of 2 arguments

by admin
Reading Time: < 1 minutes

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.

    I have had the same mistake

    docker exec -it gallant_bose
    

    C:Program FilesDocker Toolboxdocker.exe: “exec” requires a minimum of 2 arguments.
    See ‘C:Program FilesDocker Toolboxdocker.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
    

    [email protected]:/#

    Best wishes!

    Update

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

    1

    • Thank you! After the addition of ‘bash’ everything worked.

      – user3520669

      Aug 2, 2017 at 14:13

    Are you sure that test2 exists?
    I don’t see any error in your command. If problem persists, can you provide the docker ps and docker images output please?

    1

    • girod _s the container test2 exists, and the image that I am using (ubuntu based) is present when I run docker images.

      – user3520669

      Mar 17, 2016 at 19:05

    Leave a Comment