docker-phpLDAPadmin icon indicating copy to clipboard operation
docker-phpLDAPadmin copied to clipboard

how can i add a template ?

Open xgodon opened this issue 7 years ago • 7 comments

I'd like to add a template in /var/www/phpldapadmin/templates/creation/ at the image start. How can i do? extending the image like :

FROM osixia/phpldapadmin:0.6.12 COPY custom_posixAccount.xml /var/www/phpldapadmin/templates/creation/custom_posixAccount.xml

give me the error : "phpldapadmin_1 | cp: cannot create regular file ‘/var/www/phpldapadmin/config/config.php’: No such file or directory"

xgodon avatar May 16 '17 15:05 xgodon

I had the same problem. Lokking at the Dockerfile and the scripts, I figured you can copy them to the bootstrap directory to make it work.

e.g.:

FROM osixia/phpldapadmin:0.7.0
COPY custom_posixAccount.xml /var/www/phpldapadmin_bootstrap/templates/creation/custom_posixAccount.xml

dcendents avatar Aug 22 '17 17:08 dcendents

Neither works for me:

FROM osixia/phpldapadmin:0.7.2
COPY custom_example.xml /var/www/phpldapadmin_bootstrap/templates/creation/custom_example.xml
COPY custom_example.xml /var/www/phpldapadmin/templates/creation/custom_example.xml

custom_example.xml is successfully copied to /var/www/phpldapadmin_bootstrap/templates/creation/ but is not found in /var/www/phpldapadmin/templates/creation/. If I copy the xml manually (with docker exec) from phpldapadmin_bootstrap to phpldapadmin, I can see that the template loads correctly in the web interface.

I have also tried setting the file permissions to match the other template files with RUN chown www-data:www-data /var/www/phpldapadmin_bootstrap/templates/creation/custom_example.xml

Anything I'm missing here?

JensPfeifle avatar Sep 30 '18 10:09 JensPfeifle

The dockerfile declares a VOLUME for /var/www/phpldapadmin. You need to remove it inbetween changes, otherwise they are not updated from the bootstrap folder.

danekja avatar Nov 26 '18 14:11 danekja

@BertrandGouny why not remove the Dockerfile config

VOLUME ["/var/www/phpldapadmin"]

it make difficulty to build my docke image, I have to rebuild the docker image, can't build from this image, I think the rebuild time is wasteful, can you improve this ?

At last, thanks for your spend time to complete this good project

shynome avatar Dec 12 '18 08:12 shynome

I had the same problem and the solution given in https://github.com/osixia/docker-phpLDAPadmin/issues/30#issuecomment-324091598 worked perfectly for me with version 0.7.2. Thank you!

graue70 avatar Mar 08 '19 14:03 graue70

Here is how I did it: Dockerfile

FROM osixia/phpldapadmin:0.9.0
COPY customUser.xml /
COPY startup.sh /container/service/phpldapadmin-additional-templates/
RUN chmod +x /container/service/phpldapadmin-additional-templates/startup.sh

startup.sh

#!/bin/bash -e
TEMPLATE_PATH=/customUser.xml

if [ -f $TEMPLATE_PATH ]; then
  mv $TEMPLATE_PATH  /var/www/phpldapadmin/templates/creation/
fi

exit 0

More info https://github.com/osixia/docker-light-baseimage#startupsh

Vsevo1od avatar Sep 09 '20 13:09 Vsevo1od

Thank you @Vsevo1od your solution worked perfectly for me 👍

tomdaley92 avatar Jul 31 '21 20:07 tomdaley92