docker 创建私有仓库registry 链接ldap

1,与前边一篇步骤一样,只是将auth_config.yml中加点配置,在里边改吧改吧,即

# . See reference.yml for explanation for explanation of all options.
#
# auth:
# token:
# realm: "https://127.0.0.1:5001/auth"
# service: "Docker registry"
# issuer: "Acme auth server"
# rootcertbundle: "/path/to/server.pem"
 
server:
addr: ":5001"
certificate: "/certs/auth.crt"
key: "/certs/auth.key"
 
token:
issuer: "Acme auth server" # Must match issuer in the Registry config.
expiration: 900
 
# LDAP authentication.
# Authentication is performed by first binding to the server, looking up the user entry
# by using the specified filter, and then re-binding using the matched DN and the password provided.
ldap_auth:
addr: "ldap:389"
#tls: true
# In case bind DN and password is required for querying user information,
# specify them here. Plain text password is read from the file.
bind_dn: "uid=serviceaccount,ou=it,dc=example,dc=com"
# Make sure you remove newlines and carriage returns from the password file.
bind_password_file: /tmp/ldap_password.txt.clean
# User query settings. ${account} is expanded from auth request
base: "ou=musicians,dc=example,dc=com"
filter: "(&(uid=${account})(objectClass=organizationalPerson))"
 
users:
# Password is specified as a BCrypt hash. Use htpasswd -B to generate.
"admin":
password: "$2y$05$LO.vzwpWC5LZGqThvEfznu8qhb5SGqvBSWY1J3yZ4AxtMRZ3kN5jC" # badmin
"test":
password: "$2y$05$WuwBasGDAgr.QCbGIjKJaep4dhxeai9gNZdmBnQXqpKly57oNutya" # 123
 
acl:
# Admin has full access to everything.
- match: {account: "admin"}
actions: ["*"]
 
# User "user" can pull stuff.
- match: {account: "test"}
actions: ["pull"]
 
# This will allow authenticated users to pull/push
- match:
account: /.+/
actions: ['*']
 
# The user "serviceaccount" (from LDAP) may not perform any docker actions
# like push or pull.
- match: {account: "serviceaccount"}
actions: []


2,运行命令:

1,docker run -d --name docker_auth -p 5001:5001 \
-v /data/192.168.111.128/config:/config:ro \
--restart=always \
-v /data/192.168.111.128/ssl:/ssl cesanta/docker_auth /config/ldap_auth.yml


3,docker run -d -p 5000:5000 \
-e REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry \
-e REGISTRY_AUTH=token \
-e REGISTRY_AUTH_TOKEN_REALM=https://192.168.111.128:5001/auth \
-e REGISTRY_AUTH_TOKEN_SERVICE="Docker registry" \
-e REGISTRY_AUTH_TOKEN_ISSUER="Acme auth server" \
-e REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/ssl/server.pem \
-v /data/192.168.111.128/ssl:/ssl \
--restart=always \
--name registry registry


4,就可以用ldap中的用户登录,push和pull了。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值