compose icon indicating copy to clipboard operation
compose copied to clipboard

Allow disabling ports (for merging multiple compose files)

Open adrianhelvik opened this issue 4 years ago • 7 comments

Is your feature request related to a problem? Please describe. When calling docker-compose with multiple files for separate environments and want to override port settings, you can't and you'll have to duplicate the files or do another sort of black magic.

Describe the solution you'd like Allow ports to contain none-mappings that override previous mappings in the array.

In other words, this:

services:
  my-service:
    ports:
      - 5000:6000
      - 1234:1234
      - 1234:none

Should have the same behavior as this:

services:
  my-service:
    ports:
      - 5000:6000

Describe alternatives you've considered

  • Replacing the array instead of merging the two, but that is a breaking change.
  • Using a suffix or prefix to indicate that you want to override (ports_override). But that may require a bit of work.
  • Specifying override_strategy: overwrite, which is a decent solution, but seems harder to implement and has a wider scope. (As discussed in #2260)
  • Using multiple compose files: Causes a lot of duplication and makes it harder to start an app with one command.
  • Search/replace and piping the file to docker-compose, but that is hacky and ugly.

adrianhelvik avatar Apr 13 '21 11:04 adrianhelvik

This could be done in compose/config/config.py in process_ports I believe. New to the code base and my Python is getting rusty.

adrianhelvik avatar Apr 14 '21 07:04 adrianhelvik

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[bot] avatar Oct 30 '21 16:10 stale[bot]

This could be also a good solution for #3729.

LightTemplar avatar Jan 07 '22 02:01 LightTemplar

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

stale[bot] avatar Jan 07 '22 02:01 stale[bot]

That's an interesting proposal. Should be discussed under Compose Specification (https://github.com/compose-spec/compose-spec)

ndeloof avatar Jan 14 '22 08:01 ndeloof

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[bot] avatar Jul 31 '22 02:07 stale[bot]

👋🏼

logopk avatar Jul 31 '22 06:07 logopk

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

stale[bot] avatar Aug 13 '22 12:08 stale[bot]

🍀

logopk avatar Aug 13 '22 20:08 logopk

This was not solved - please reopen

logopk avatar Aug 13 '22 20:08 logopk