Skip to content

Wiki page for LDAP suggestion to use override conflicts with main docker-compose.yml #360

Closed
@JonathonReinhart

Description

@JonathonReinhart

Thanks for the nice integration! I'm setting up an LDAP instance and found a small gotcha:

Background

The main docker-compose.yml uses a YAML anchor and reference to specify the netbox-worker container:

services:
  netbox: &netbox
    # ...
  netbox-worker:
    <<: *netbox
    # ...

The current version of the LDAP wiki page suggests using a docker-compose.override.yml file which changes that image to the -ldap variant:

services:
  netbox:
    image: netboxcommunity/netbox:${VERSION-latest-ldap}
    # ...

Problem

The problem is this:

  1. The YAML anchor/reference in docker-compose.yml is evaluated first, effectively yielding this:
    services:
      netbox:
        image: netboxcommunity/netbox:latest
        # ...
      netbox:
        image: netboxcommunity/netbox:latest
        # ...
  2. The docker-compose.override.yml content is applied, effectively yielding this:
    services:
      netbox:
        image: netboxcommunity/netbox:latest-ldap
        # ...
      netbox:
        image: netboxcommunity/netbox:latest
        # ...

As you can see, this leads to a disconnect between the images used for the netbox and netbox-worker containers:

# docker-compose images
          Container                   Repository             Tag         Image Id       Size  
----------------------------------------------------------------------------------------------
netbox-docker_netbox-worker_1   netboxcommunity/netbox   latest        03f42c259997   220.9 MB
netbox-docker_netbox_1          netboxcommunity/netbox   latest-ldap   1749d1867724   225.9 MB
netbox-docker_nginx_1           nginx                    1.19-alpine   4efb29ff172a   21.81 MB
netbox-docker_postgres_1        postgres                 12-alpine     44c9a6a10db6   157.7 MB
netbox-docker_redis-cache_1     redis                    6-alpine      c1949ec48c51   31.15 MB
netbox-docker_redis_1           redis                    6-alpine      c1949ec48c51   31.15 MB

I haven't yet determined if this causes any problems, but it seems like undesired behavior.

Workaround

The workaround is simple, adding this to the suggested docker-compose.override.yml file:

  netbox-worker:
    image: netboxcommunity/netbox:${VERSION-latest-ldap}
# docker-compose images
          Container                   Repository             Tag         Image Id       Size  
----------------------------------------------------------------------------------------------
netbox-docker_netbox-worker_1   netboxcommunity/netbox   latest-ldap   1749d1867724   225.9 MB
netbox-docker_netbox_1          netboxcommunity/netbox   latest-ldap   1749d1867724   225.9 MB
netbox-docker_nginx_1           nginx                    1.19-alpine   4efb29ff172a   21.81 MB
netbox-docker_postgres_1        postgres                 12-alpine     44c9a6a10db6   157.7 MB
netbox-docker_redis-cache_1     redis                    6-alpine      c1949ec48c51   31.15 MB
netbox-docker_redis_1           redis                    6-alpine      c1949ec48c51   31.15 MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationAn issue with the documentation or a request for more of it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions