12

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.

entpnerd
  • 10,049
  • 8
  • 47
  • 68

2 Answers2

22

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

Harold Castillo
  • 2,006
  • 19
  • 23
2

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?

Sylvain GIROD
  • 836
  • 1
  • 11
  • 23
  • girod _s the container test2 exists, and the image that I am using (ubuntu based) is present when I run docker images. –  Mar 17 '16 at 19:05