Hi,
I use the following command to start Confluence in a Docker container:
docker run -v ~/Docker/confluence:/var/atlassian/application-data/confluence --name="confluence" -p 8090:8090 -p 8091:8091 atlassian/confluence-server
The server starts up fine and I complete setup with the built-in database and an example site.
As soon as I stop and restart the container, Confluence greets me with the setup dialog again. Confluence shows the following messages in its startup log:
$ docker start -a confluence
INFO:root:Generating /opt/atlassian/confluence/conf/server.xml from template server.xml.j2
INFO:root:Generating /opt/atlassian/confluence/confluence/WEB-INF/classes/seraph-config.xml from template seraph-config.xml.j2
INFO:root:Generating /opt/atlassian/confluence/confluence/WEB-INF/classes/confluence-init.properties from template confluence-init.properties.j2
INFO:root:Generating /var/atlassian/application-data/confluence/confluence.cfg.xml from template confluence.cfg.xml.j2
INFO:root:User is currently root. Will change directory ownership to confluence then downgrade permissions
INFO:root:Running Confluence with command '/bin/su', arguments ['/bin/su', 'confluence', '-c', '/opt/atlassian/confluence/bin/start-confluence.sh -fg']
executing as current user
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
As you can see, Confluence overrides my existing confluence.cfg.xml with an empty template file.
What am I missing here? Do I have to pass an environment variable for Confluence to pick up its existing configuration file?
I was able to reproduce this issue on an Ubuntu 18.04 Server and on a Mac running macOS 10.14.6, both using the latest Docker version.
Thank you for your help!
UPDATE:
I conducted a little research and found out that the 'confluence.cfg.xml' is generated by a script called 'entrypoint.py' in the root directory of the container. I also found out that I can specify my database configuration with the following environment variables:
ATL_DB_TYPE=
ATL_JDBC_URL=
ATL_JDBC_USER=
ATL_JDBC_PASSWORD=
But even with these variables set, Confluence still boots to the setup screen on subsequent launches.
I wonder if this script is supposed to run on every container start? If so, how can I inject the remaining values (e.g. the license) and skip the setup? If not, how can I skip the generation step on subsequent launches of the container?
My current workaround is to inject a copy of 'entrypoint.py' into the container without the generation command. But this is merely a bad workaround and likely to cause issues with future updates.