<p>I'm migrating Confluence from a VM to an instance of Confluence Server 7.11.1 using the official Atlassian docker image in Kubernetes. I successfully got the application to come up, and was able to get through the set-up screens to start an empty Confluence.</p>
<p>To customize my instance I want to copy over my old server's confluence home directory to the default confluence home location and also change the database connection URL. According to documentation <a href="https://confluence.atlassian.com/conf59/migrating-confluence-between-servers-792499892.html" rel="nofollow noreferrer">here</a>, I need to stop confluence from running while doing this. I tried to run the stop-confluence.sh script from the confluence user, but I can't stop the container because there is no catalina.pid file in the docker version of k8s.</p>
<p>I tried the alternative of killing the java process that runs Confluence, but the entire container shuts down when I do this.</p>
<p>How do I stop Confluence in Kubernetes so that I can copy files and modify configuration in the container? Is the docker image version of the Confluence application not meant to be stopped and everything needs to be provided as env variables? Notes on the official atlassian docker image configuration is <a href="https://hub.docker.com/r/atlassian/confluence-server/" rel="nofollow noreferrer">here</a>.</p>
<p>Error message:</p>
<pre><code>confluence@usmai-www-confluence-0:~$ /opt/atlassian/confluence/bin/stop-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

Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /opt/java/openjdk/bin/java
2021-05-19 23:29:48,363 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A Context element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/confluence/conf/server.xml. No further action is required
---------------------------------------------------------------------------
Using CATALINA_BASE:   /opt/atlassian/confluence
Using CATALINA_HOME:   /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME:        /opt/java/openjdk
Using CLASSPATH:       /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar
Using CATALINA_OPTS:   -XX:ReservedCodeCacheSize=256m -XX:+UseCodeCacheFlushing -Djdk.tls.server.protocols=TLSv1.1,TLSv1.2 -Djdk.tls.client.protocols=TLSv1.1,TLSv1.2 -Dconfluence.context.path=/portal  -Djava.locale.providers=JRE,SPI,CLDR -Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 -Dsynchrony.enable.xhr.fallback=true -Xms1024m -Xmx1024m -Dconfluence.home= -XX:+UseG1GC -Datlassian.plugins.enable.wait=300 -Djava.awt.headless=true -XX:G1ReservePercent=20 -Xloggc:/opt/atlassian/confluence/logs/gc-2021-05-19_23-29-48.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M -Xlog:gc+age=debug:file=/opt/atlassian/confluence/logs/gc-2021-05-19_23-29-48.log::filecount=5,filesize=2M -XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution -XX:+IgnoreUnrecognizedVMOptions   -DConfluenceHomeLogAppender.disabled=
Using CATALINA_PID:    /opt/atlassian/confluence/work/catalina.pid
$CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop aborted.
</code></pre>

moglido
<p>Apparently, the confluence java process is the &quot;ENTRYPOINT&quot; for the docker container, so when you kill the java process, it kills the container as well.</p>
<p>I would suggest that you create a persistent volume with readWriteMany attribute set and mount it to a temporary pod - say with ubuntu image.</p>
<p>You then use &quot;kubectl  cp&quot; to copy the existing home directory to the persistent volume mounted on the ubuntu pod.</p>
<p>You can then  make any modifications to the files as you please.
Once done, just kill the ubuntu pod.</p>
<p>Your files will still be present on the persistent volume.</p>
<p>Now mount this persistent volume to /opt/atlassian/confluence in your confluence pod and it it should just work.</p>
