Docker Community Forums

Share and learn in the Docker community.

Docker-compose with piping fails

If I attempt to use docker-compose up with a piped-in docker-compose file I experience a failure:

me@me-desktop:/tmp$ echo "version: '3'

services:
  container1:
    image: quay.io/my-org/image

  container2:
    image: quay.io/my-org/image
  " | docker-compose -f - up 

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 11, in <module>
    load_entry_point('docker-compose==1.25.0', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 72, in main
    command()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 125, in perform_command
    project = project_from_options('.', options)
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 53, in project_from_options
    return get_project(
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 156, in get_project
    execution_context_labels(config_details, environment_file),
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 163, in execution_context_labels
    '{0}={1}'.format(LABEL_CONFIG_FILES, config_files_label(config_details)),
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 172, in config_files_label
    return ",".join(
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 173, in <genexpr>
    map(str, (os.path.normpath(c.filename) for c in config_details.config_files)))
  File "/usr/lib/python3.8/posixpath.py", line 336, in normpath
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

However, if I write this same configuration to a docker-compose.yml file and run docker-compose up the two containers come up just fine. Unfortunately for my test setup, I need to be able to pipe and can’t write to disk.

Was wondering if anyone has experienced this or had guidance, thanks!