2

I want to write the equivalent of the following in docker-compose.yaml.

How can I do that?

docker run -it myImage 
0

1 Answer 1

3

You actually have 2 flags:

  • i - Keep STDIN open even if not attached
  • t - Allocate a pseudo-TTY

So we just need to find the right keys to put in docker-compose.yaml (tty & stdin_open)

version: "3.9" #you can put you own version services: yourServiceName: image: yourImageName tty: true # equivalent for -t stdin_open: true # equivalent for -i 

Now you can use docker-compose up to run your container (or docker-compose start if you already have a created container)

More info about other flags (LINK)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.