title: How to connect to OpenDJ LDAP server (Docker)
body: <p>I am trying to connect(bind) to an OpenDJ server in Docker.  </p>
  
  <p>(I know how to connect to regular (not Docker) OpenDJ server)</p>
  
  <p>OpenDJ seems to run, but when I try to connect to it with a ldap browser, it says "Unabled to connect" </p>
  
  <pre><code>          --- Server Status ---
  Server Run Status:        Started
  Open Connections:         1
  
            --- Server Details ---
  Host Name:                14e1e92e962e
  Administrative Users:     cn=Directory Manager
  Installation Path:        /opt/opendj
  Instance Path:            /opt/opendj/data
  Version:                  OpenDJ Server 4.4.3
  Java Version:             1.8.0_111
  Administration Connector: Port 4444 (LDAPS)
  
            --- Connection Handlers ---
  Address:Port : Protocol               : State
  -------------:------------------------:---------
  --           : LDIF                   : Disabled
  0.0.0.0:161  : SNMP                   : Disabled
  0.0.0.0:1389 : LDAP (allows StartTLS) : Enabled
  0.0.0.0:1636 : LDAPS                  : Enabled
  0.0.0.0:1689 : JMX                    : Disabled
  0.0.0.0:8080 : HTTP                   : Disabled
  
            --- Data Sources ---
  Base DN:     dc=example,dc=com
  Backend ID:  userRoot
  Entries:     1
  Replication:
  </code></pre>
  
  <pre><code>[root@localhost ~]# docker ps
  CONTAINER ID        IMAGE                         COMMAND                CREATED             STATUS              PORTS                          NAMES
  14e1e92e962e        openidentityplatform/opendj   "/opt/opendj/run.sh"   18 hours ago        Up 18 hours 
  </code></pre>
  
  <pre><code>[root@localhost ~]# ifconfig
  docker0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
          inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
          inet6 fe80::42:5ff:fe0f:a03  prefixlen 64  scopeid 0x20&lt;link&gt;
          ether ********  txqueuelen 0  (Ethernet)
          RX packets 5  bytes 254 (254.0 B)
          RX errors 0  dropped 0  overruns 0  frame 0
          TX packets 7  bytes 647 (647.0 B)
          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  
  enp3s0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
          inet 192.168.0.89  netmask 255.255.255.0  broadcast 192.168.0.255
          inet6 fe80::1db8:91e1:5276:4f9  prefixlen 64  scopeid 0x20&lt;link&gt;
          ether ********  txqueuelen 1000  (Ethernet)
          RX packets 796434  bytes 512206712 (488.4 MiB)
          RX errors 0  dropped 0  overruns 0  frame 0
          TX packets 479946  bytes 41277150 (39.3 MiB)
          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  </code></pre>
  
  <pre><code>[root@localhost ~]# docker run -it 1e03b62c213e /bin/bash
  Instance data Directory is empty. Creating new DJ instance
  BASE DN is dc=example,dc=com
  Password set to password
  Running /opt/opendj/bootstrap/setup.sh
  Setting up default OpenDJ instance
  
  Configuring Directory Server ..... Done.
  Configuring Certificates ..... Done.
  Creating Base Entry dc=example,dc=com ..... Done.
  Starting Directory Server ...... Done.
  
  To see basic server configuration status and configuration, you can launch
  /opt/opendj/bin/status
  
  Server Run Status:        Started
  </code></pre>
  
  <p>The LDAP server is running at 192.168.0.89 with a port of 1389. So I try to connect with the below.  I am unable to fetch Base DN as well. I tried putting the BaseDN manually too.  I tried 172.17.0.1, but no luck. (It seems to be a docker ip. (ifconfig)) </p>
  
  <p><strong>Question :</strong> 
  <strong>But with docker, do I need a different hostname? or IP? Or need additional configuration setup?</strong> (BTW, I put IP in hostname and successfully connected many times.) </p>
  
  <p><a href="https://i.stack.imgur.com/0i7NN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0i7NN.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/2iwCg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2iwCg.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/o4H5a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o4H5a.png" alt="enter image description here"></a></p>
  
  <p><strong>Error message :</strong></p>
  
  <blockquote>
    <p>Error while opening connection
     - Unable to connect
    java.lang.Exception: Unable to connect
        at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$1.run(DirectoryApiConnectionWrapper.java:251)
        at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.runAndMonitor(DirectoryApiConnectionWrapper.java:1312)
        at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.doConnect(DirectoryApiConnectionWrapper.java:281)
        at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.connect(DirectoryApiConnectionWrapper.java:172)
        at org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable.run(OpenConnectionsRunnable.java:111)
        at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:109)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)</p>
    
    <p>Unable to connect</p>
  </blockquote>