docker compose文件中的gitlab多行行配置

布尔采夫

在docker-compose.yml中无法将var GITLAB_OMNIBUS_CONFIG ldap多行yaml配置添加到环境中,因为:

# Add any other gitlab.rb configuration here, each on its own line
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main:
  label: 'LDAP'
  host: 'ldap.<>.local'
  port: 389
  uid: 'uid'
  bind_dn: 'uid=<>,ou=People,dc=,dc='
  password: '<>'
  encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
  base: '<>'
  attributes:
    username: ['uid', 'userid', 'sAMAccountName']
    email:    ['mail', 'email', 'userPrincipalName']
    name:       'cn'
    first_name: 'givenName'
    last_name:  'sn'
EOS

有解决方案吗?

塔伦·拉尔瓦尼(Tarun Lalwani)

PS:根据需要将评论发布为答案

您在下面尝试过吗?

version: '3'
services:
  nginx:
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
        main:
          label: 'LDAP'
          host: 'ldap.<>.local'
          port: 389
          uid: 'uid'
          bind_dn: 'uid=<>,ou=People,dc=,dc='
          password: '<>'
          encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
          base: '<>'
          attributes:
            username: ['uid', 'userid', 'sAMAccountName']
            email:    ['mail', 'email', 'userPrincipalName']
            name:       'cn'
            first_name: 'givenName'
            last_name:  'sn'
        EOS
    image: nginx

而且可以很好地验证

$ docker-compose config
services:
  nginx:
    environment:
      GITLAB_OMNIBUS_CONFIG: "gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'\n\
        main:\n  label: 'LDAP'\n  host: 'ldap.<>.local'\n  port: 389\n  uid: 'uid'\n\
        \  bind_dn: 'uid=<>,ou=People,dc=,dc='\n  password: '<>'\n  encryption: 'plain'\
        \ # \"start_tls\" or \"simple_tls\" or \"plain\"\n  base: '<>'\n  attributes:\n\
        \    username: ['uid', 'userid', 'sAMAccountName']\n    email:    ['mail',\
        \ 'email', 'userPrincipalName']\n    name:       'cn'\n    first_name: 'givenName'\n\
        \    last_name:  'sn'\nEOS\n"
    image: nginx
version: '3.0'

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章