Open encryptblockr opened 4 years ago
What is your volume config? Do you have files in your (existing) volume?
i mounted the following volumes to my local host
/var/lib/ldap
and /etc/ldap/slapd.d
so like below
docker run ... -v /data/ldap:/var/lib/ldap -v /data/slapd:/etc/ldap/slapd.d osixia/openldap:latest
and i already spun up the server once and now i made some changes to the docker network i want it on and now tried to restart/start it again and now i got the mount error
i mounted the following volumes to my local host
/var/lib/ldap
and/etc/ldap/slapd.d
so like below
docker run ... -v /data/ldap:/var/lib/ldap -v /data/slapd:/etc/ldap/slapd.d osixia/openldap:latest
and i already spun up the server once and now i made some changes to the docker network i want it on and now tried to restart/start it again and now i got the mount error
U may need to only mount /tmp:/tmp at initial .
After the docker running,
run in docker cp -ar /var/lib/ldap /tmp/; cp -ar /etc/ldap/slapd.d /tmp/
On host machine, cp -ar /tmp//var/lib/ldap/* /data/ldap; cp -ar /tmp//etc/ldap/slapd.d/* /data/slapd
Then you can run openldap with (Persistent storage) via:
-v /data/ldap:/var/lib/ldap -v /data/slapd:/etc/ldap/slapd.d
btw:
You may need to remove unused volumes
via docker volume ls && docker volume rm
Run this at the first time..
version: '2.4'
services:
openldap:
image: osixia/openldap:1.3.0
container_name: openldap
network_mode: host
restart: unless-stopped
environment:
...
TZ: 'Asia/Shanghai'
KEEP_EXISTING_CONFIG: "true"
LDAP_REMOVE_CONFIG_AFTER_SETUP: "false"
...
tty: true
stdin_open: true
volumes:
- /var/lib/ldap
- /etc/ldap/slapd.d
- '/tmp:/tmp'
# - /container/service/slapd/assets/certs/
...
Done with cp things
, then you can use this now:
version: '2.4'
services:
openldap:
image: osixia/openldap:1.3.0
container_name: openldap
network_mode: host
restart: unless-stopped
environment:
...
TZ: 'Asia/Shanghai'
KEEP_EXISTING_CONFIG: "true"
LDAP_REMOVE_CONFIG_AFTER_SETUP: "false"
...
tty: true
stdin_open: true
volumes:
- '/data/docker/openldap/var/lib/ldap:/var/lib/ldap'
- '/data/docker/openldap/etc/ldap/slapd.d:/etc/ldap/slapd.d'
# - '/tmp:/tmp'
# - /container/service/slapd/assets/certs/
...
this is an awful way to build a docker image....makes sense to be running first time and then second time but this is not a good practice..you should be able to run once and things should stick where they should
Well for some reason this VOLUME
line is commented. Maybe uncommenting it should do the trick.
I am not sure why they are being commented out.
@phy25 not sure this is the reason why because this commented code has been there for 2 years (from git blame)
@encryptblockr a test was added to see if taking volumes from existing host data worked and AFAIK it does (just tried right now on Linux and MacOSX hosts)
the best thing would be to have your entire docker run ...
command line and the full output when using --loglevel debug
to be able to have a chance to progress on this
@obourdon I apologize, I might have messed up my memory with another docker image which requires manually copying.
Looks like it is working on my end as well:
@phy25 no pb at all and many thanks for checking this on your side
i think this issue was mention in #283 but this issue still exists when one tries to restart ldap when volume is mounted to host
here is error log am getting
running current latest docker image
4c780dfa5f5e
4 months agoanyone seems to know work around for this?