qfazille
qfazille

Reputation: 1671

ldap client container works with docker run but not on docker-compose or docker-stack

Case 1 : Classic docker run

With env-file :

BASE_DN=dc=example,dc=com
URI=ldap://XX.XX.XXX.XXX:389
ROOT_ADDCOUNT=cn=admin,dc=example,dc=com
ROOT_PASSWORD=mypassword

Run the docker with :

docker run --env-file ./env-file -it -d akhilrajmailbox/ldap-client:latest /bin/bash

Get into the docker with

docker exec -it <container_id> bash

==> Works, I can then reach my ldap

Case 2 : With docker-compose

With docker-compose.yml :

version: "3"

services:
  ldap_client:
    restart: always
    image: akhilrajmailbox/ldap-client:latest
    environment:
      - 'BASE_DN="dc=example,dc=com"'
      - 'URI="ldap://XX.XX.XXX.XXX:389"'
      - 'ROOT_ADDCOUNT="cn=admin,dc=example,dc=com"'
      - 'ROOT_PASSWORD="mypassword"'

Run the docker-compose with :

docker-compose up -d

Get into the docker with

docker exec -it <container_id> bash

==> Doesn't work, I cannot then reach my ldap

Case 3 : With docker-stack

With same docker-compose.yml as above.

Run the docker-stack with :

docker stack deploy --compose-file=docker-compose.yml my_stack

Get into the container as above

==> Doesn't work, I cannot then reach my ldap

hints :

Upvotes: 2

Views: 543

Answers (1)

akhil raj
akhil raj

Reputation: 21

I tried to reproduce the issue with docker version 2, and the problem is in your "environment: " block. try to use the following format (avoid : " ) Example :: use 'BASE_DN=dc=example,dc=com' instead of 'BASE_DN="dc=example,dc=com"'

version: "2"

services:
  ldap_client:
    restart: always
    image: akhilrajmailbox/ldap-client:latest
    environment:
      - 'BASE_DN=dc=example,dc=com'
      - 'URI=ldap://XX.XX.XXX.XXX:389'
      - 'ROOT_ADDCOUNT=cn=admin,dc=example,dc=com'
      - 'ROOT_PASSWORD=mypassword'

Note :: I tried with docker version 2 in yaml file.

Upvotes: 2

Related Questions