Compose: Error when using multiple -f flags and stdin ( -f - )

Created on 10 May 2016  路  10Comments  路  Source: docker/compose

Hi!

When using multiple files, and also passing data in via stdin:

cat docker-compose_files/postgres.yml | docker-compose  -f docker-compose_files/consul.yml -f - -p test up

I get the following error:

ERROR: .IOError: [Errno 2] No such file or directory: u'./-'

Looks like it's not reading from stdin, but trying to open the hyphen as a filename?

Thanks!

arecli areconfig kinenhancement stale

Most helpful comment

Please reopen

All 10 comments

Thanks for the report!

Yes, this is not currently possible, but it should be easy enough to tweak the code to support this use case, unless I'm missing some practical concerns.

This would be quite useful with combination of docker-app where we render the main config and pipe in into compose but still need some local override.

docker-app render | docker-compose -f - -f docker-compose.local.yml ps

I haven't yet found a way to configure everything with docker-app such that it works with just a single file.

I'm having the problem with the same use case as @Fuco1. Currently having to send the output of docker-app render to a file to allow compose to use two inputs. Would be much easier not having to do so.

docker-app render > /tmp/docker-compose.yml
docker-compose -f /tmp/docker-compose.yml -f docker-compose-local.yml ps

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale not a stale issue, this is still a problem

This issue has been automatically marked as not stale anymore due to the recent activity.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because it had not recent activity during the stale period.

Please reopen

You can specify /dev/stdin as the file you want to read from, and then pipe as normal.
e.g. -f /dev/stdin
Be sure to put all other -f arguments before this special -f argument.
When I did not put -f /dev/stdin after all other -f arguments I had problems with relative paths in those files that came after -f /dev/stdin.

You can read a little more at:
https://stackoverflow.com/questions/53695725/use-docker-compose-config-from-file-and-stdin

Was this page helpful?
0 / 5 - 0 ratings