fwind
fwind

Reputation: 1314

Use docker compose config from file and stdin

docker-compose can use a config file from stdin using -f - (Example: cat config.yml | docker-compose -f - up)

However, this does not seem to work when providing multiple config files. For example, the command:

cat config.yml | docker-compose -f ./docker-compose.yml -f - up

returns with the error: ERROR: .FileNotFoundError: [Errno 2] No such file or directory: './-'

Is there a way to use multiple config files and still provide one config through stdin?

Upvotes: 1

Views: 2029

Answers (1)

larsks
larsks

Reputation: 311506

You can use the special device /dev/stdin, as in:

cat config.yml | docker-compose -f docker-compose.yml -f /dev/stdin up

This may not work in all cases (I've encountered some oddness when -f /dev/stdin is the first file listed on the command line), but it does seem to work.

Upvotes: 2

Related Questions