Skip to content

$CurrentContainer cannot be initialized when -only-exposed is used #458

@bap2pecs

Description

@bap2pecs

If using docker-gen and nginx separately instead of nginx-proxy, the official template does not work when -only-exposed (or -only-published) is used.

After debugging, I found out that the root cause is $CurrentContainer is not initialized properly. This is expected because the docker-gen container does not expose any ports. So

{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}

cannot find the docker-gen container inside $ (the list of all containers)

A possible solution is to explicitly expose .CurrentContainer as a top-level argument to the template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions