Docker Community Forums

Share and learn in the Docker community.

How to make 'docker run' works without any options such as -i -t -d?


(Moonsyim) #1

Hello,
Actually, I’m new for Docker and running now but a lot of uncertainties.

how to make ‘docker run’ works without any options such as -i -t -d?

for example,
docker run -p 3306:3306 moonsyim/amazon-linux-ami-mysql-20150630:0.1
it just goes Exited(0).

but with options like
no option : just Exited(0).
-i : works -> no prompt, but exited by ctrl+C
-t : works -> no prompt, still running by ctrl+C
-d : just Exited (0)

-i -t : goes into the container directly
-i -d : works
-t -d : works
-i -t -d : works

I’d like to make ‘docker run’ without options, would you give me some idea?
does it matter with COMMAND “/bin/bash” in below?

If I do ‘docker run’ with options, then

docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e480e7d14212 moonsyim/amazon-linux-ami-mysql-20150630:0.1 “/bin/bash” 7 seconds ago Up 6 seconds 0.0.0.0:3306->3306/tcp jolly_perlman


(K3ck3c) #2

It depends what you want to achieve, if you want to run mysql, try to launch it with -d

Why do you want to run it without -d -i -t ?

You should have a close look at the doc

http://docs.docker.com/reference/commandline/run/


(Moonsyim) #3

Yes, I’d like to use Amazon AWS ECS service, and it launch docker images, but we can’t specify any like -i -t -d in Amazon AWS ECS task definition. it looks Amazon ECS Task does just ‘docker run image’ without any options, so I’m looking for that way.


(Roel Van De Paar) #4

Why not add a small bash script that has the right options in it so you can just let that be run as a task?