saltstack-formulas / docker-formula

Install and set up Docker
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
136 stars 330 forks source link

[BUG] Setting ports for container throws the error: is not a valid port definition #279

Closed MurzNN closed 3 years ago

MurzNN commented 3 years ago

I'm trying to set ports mapping for the contaner, using this pillar structure:

docker:
  wanted:
    - docker
    - compose

  containers:
    running:
      - pgadmin

    pgadmin:
      image: dpage/pgadmin4
      ports:
        - '88:80'
      volumes:
        - /pgadmin4:/var/lib/pgadmin

The format of ports line I get from pillar.example file.

But when applying this config, I got the error:

          ID: docker-containers-pgadmin-running
    Function: docker_container.running
        Name: pgadmin
      Result: False
     Comment: Failed to translate input. Additional info follows:

              invalid:
                  ----------
                  ports:
                      '{88: 80}' is not a valid port definition

              If you feel this information is incorrect, the skip_translate argument can be used to skip input translation for the argument(s) identified as invalid. See the documentation for details.
     Started: 13:59:50.387972
    Duration: 33.969 ms
     Changes:   

Where can be the problem? Maybe the pillar.example file is outdated, and we need to use other format for ports settings?

MurzNN commented 3 years ago

When analyzing sources, I figured-out other way to define ports, that works well:

      port_bindings:
        - '88:80'

Should I update the pillar.example to add this example, or it is wrong?

noelmcloughlin commented 3 years ago

Hey Aexey, Yes, please do that update. regards Noel

On Mon, Apr 12, 2021 at 12:24 PM Alexey Murz Korepov < @.***> wrote:

When analyzing sources, I figured-out other way to define ports, that works well:

  port_bindings:
    - '88:80'

Should I update the pillar.example to add this example, or it is wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/saltstack-formulas/docker-formula/issues/279#issuecomment-817729567, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFUUQRNNPIHILX5WO5DLDLTILJ6XANCNFSM42ZCAICA .

MurzNN commented 3 years ago

Here is PR https://github.com/saltstack-formulas/docker-formula/pull/280

MurzNN commented 3 years ago

Resolved via #280