1

I am trying to connect(bind) to an OpenDJ server in Docker.

(I know how to connect to regular (not Docker) OpenDJ server)

OpenDJ seems to run, but when I try to connect to it with a ldap browser, it says "Unabled to connect"

          --- 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:
[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 
[root@localhost ~]# ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  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<link>
        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<UP,BROADCAST,RUNNING,MULTICAST>  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<link>
        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
[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

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))

Question : But with docker, do I need a different hostname? or IP? Or need additional configuration setup? (BTW, I put IP in hostname and successfully connected many times.)

enter image description here

enter image description here

enter image description here

Error message :

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)

Unable to connect

Jin Lee
  • 3,194
  • 12
  • 46
  • 86
  • Please provide `docker run` command you used to run opendj. And also mention the port on which opendj server should be listening. – mchawre Sep 11 '19 at 05:05
  • @mchawre I used `docker run -it /bin/bash` default port is 1389, 1636 (LDAPS) . – Jin Lee Sep 11 '19 at 05:09

2 Answers2

4

You need to publish ports 1389 and 1636.

Change your docker run command to

docker run -it -p 1389:1389 -p 1636:1636 <image ID> /bin/bash

You can also run your container is host networking mode where you don't need port mapping.

docker run -it --net=host <image ID> /bin/bash

Hope this helps.

masseyb
  • 3,745
  • 1
  • 17
  • 29
mchawre
  • 10,744
  • 4
  • 35
  • 57
2

look at your docker ps command, you do not publish any ports

add this to your docker run command:

-p 1389:1389 -p 1636:1636
masseyb
  • 3,745
  • 1
  • 17
  • 29
LinPy
  • 16,987
  • 4
  • 43
  • 57