You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker容器网络配置故障:JIRA、OpenLDAP与phpLDAPadmin连通问题

Fix phpLDAPadmin Connectivity After Switching to Custom Docker Network

Let's walk through what's going wrong and how to get your phpLDAPadmin talking to OpenLDAP again with the custom network setup:

What's Causing the Problem

When you used --link ldap-service:ldap-host earlier, Docker created an internal hostname alias ldap-host that pointed to your OpenLDAP container inside the phpLDAPadmin container. But once you switched to the custom sample-network and removed the --link flag, that alias disappeared. Your phpLDAPadmin is still trying to connect to ldap-host, which it can't resolve in the new network—even though custom networks support DNS resolution for container names directly.

Step-by-Step Solution

1. Clean Up the Old phpLDAPadmin Container

First, shut down and remove the misconfigured phpLDAPadmin container:

docker stop phpldapadmin-service
docker rm phpldapadmin-service

2. Re-launch phpLDAPadmin with Correct Settings

Start a new phpLDAPadmin container, add it to your custom network, and update the environment variable to use the actual OpenLDAP container name (which the custom network can resolve via DNS):

docker run --name phpldapadmin-service \
  --hostname phpldapadmin-service \
  --network sample-network \
  --env PHPLDAPADMIN_LDAP_HOSTS=ldap-service \
  --detach osixia/phpldapadmin:0.7.1

3. Verify the Connection

Once the container is running, access phpLDAPadmin via your browser (using https://172.17.0.3/ as before) and test the LDAP connection. It should now successfully resolve ldap-service through the custom network's built-in DNS.

Why This Works

Custom Docker bridge networks come with native DNS resolution that lets containers communicate using each other's container names directly. By setting PHPLDAPADMIN_LDAP_HOSTS=ldap-service, you're telling phpLDAPadmin to target the OpenLDAP container by its actual name—no need for the deprecated --link flag anymore.

Quick Check: Ensure All Containers Are in the Same Network

Double-confirm that your OpenLDAP and JIRA containers are also part of sample-network (you mentioned you added them, but it's good to verify):

docker network inspect sample-network | grep -E "Name|ldap-service|phpldapadmin-service|mycontainer"

All three container names should appear under the "Containers" section of the output.

内容的提问来源于stack exchange,提问作者u123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:39:25