Reputation: 1671
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 :
compose
& stack
I get my environment variables. ldap://XX.XX.XXX.XXX:389
from them.Upvotes: 2
Views: 543
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