Skip to content
This repository was archived by the owner on Nov 19, 2026. It is now read-only.
This repository was archived by the owner on Nov 19, 2026. It is now read-only.

Could services be a map? #146

Open
Open

Description

@joshwget

Any reason why the second syntax couldn't be used? Maybe it's a matter of preference, but I think a map would work well for this (also resembles Docker Compose a bit more).

version: 0.1-dev
services:
- name: helloworld
  containers:
  - image: tomaskral/nonroot-nginx
    ports:
    - port: 8080
version: 0.1-dev
services:
  helloworld:
    containers:
    - image: tomaskral/nonroot-nginx
      ports:
      - port: 8080

Activity

  1. concaf commented on May 30, 2017

    @concaf
    Collaborator

    Hey @joshwget, we have had similar discussions on #105 and elsewhere, and we decided that the OpenCompose spec should take control of all the keys in the spec to maintain consistency and to allow extending fields.
    e.g. - we recently refactored environment variables from -

    env:
    - a=b
    - x=y

    to

    env:
    - name: a
      value: b
    - name: x
      secretRef: <secret>

    The latter allows us to add more fields like referring to a secret in the env variable, without breaking the consistency, in the sense that, throughout the env definition, all the keys are in control of the spec.

    Thoughts? Would love your input on this :)

  2. joshwget commented on May 30, 2017

    @joshwget
    Author

    If I'm reading things correctly it seems like the root reason is to avoid polymorphic fields, like env would be if both of the following syntaxes were valid.

    env:
    - a=b
    
    env:
    - name: x
      secretRef: <secret>
    

    I'd argue this is one of the key strengths of Docker Compose. It allows a lot of the boiler plate to be avoided when it's not necessary.

  3. kadel commented on May 31, 2017

    @kadel
    Member

    @joshwget yes you are right. But having multiple ways of writing things can also sometimes lead to confusion.
    One of the rules that we are trying to follow is that OpenCompose has only one way of writing things.
    We might try to add shortcuts like this in the future, but right now we will try to stick with only one way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions