How to deploy Docker-Geoserver in Linux environment, Tomcat issue

I am trying to deploy a Geoserver instance using docker. I have managed to run the docker instance in my local machine running Windows. However, when I tried to deploy it using remote machine running in Debian, I am running to some problems. The error says:

Cannot start server, server instance is not configured.

The following is my docker compose file.

services:
  geoserver:
    image: docker.osgeo.org/geoserver:2.28.x
    volumes:
      - ./geoserver_data:/opt/geoserver_data/
      - ./additional_libs:/opt/additional_libs
    ports:
      - 80:8080
    env_file:
    - ./env/.prod.env

Here is the complete details of the error.

geoserver-1  | usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] [ -generateCode [ {pathname} ] ] [ -useGeneratedCode ] { -help | start | stop }
geoserver-1  | 17-Jun-2025 07:24:47.327 WARNING [main] org.apache.catalina.core.StandardContext.setPath A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [geoserver] does not meet these criteria and has been changed to [/geoserver]
geoserver-1  | 17-Jun-2025 07:24:47.354 SEVERE [main] org.apache.tomcat.util.digester.Digester.fatalError Parse fatal error at line [191] column [50]
geoserver-1  |  org.xml.sax.SAXParseException; systemId: file:/usr/local/tomcat/conf/server.xml; lineNumber: 191; columnNumber: 50; The entity name must immediately follow the '&' in the entity reference.
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1465)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:907)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1522)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
geoserver-1  |          at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1539)
geoserver-1  |          at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:583)
geoserver-1  |          at org.apache.catalina.startup.Catalina.load(Catalina.java:675)
geoserver-1  |          at org.apache.catalina.startup.Catalina.start(Catalina.java:727)
geoserver-1  |          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
geoserver-1  |          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
geoserver-1  |          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
geoserver-1  |          at java.base/java.lang.reflect.Method.invoke(Method.java:569)
geoserver-1  |          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
geoserver-1  |          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
geoserver-1  | 17-Jun-2025 07:24:47.357 WARNING [main] org.apache.catalina.startup.Catalina.parseServerXml Unable to load server configuration from [/usr/local/tomcat/conf/server.xml]
geoserver-1  |  org.xml.sax.SAXParseException; systemId: file:/usr/local/tomcat/conf/server.xml; lineNumber: 191; columnNumber: 50; The entity name must immediately follow the '&' in the entity reference.
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1251)
geoserver-1  |          at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
geoserver-1  |          at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1539)
geoserver-1  |          at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:583)
geoserver-1  |          at org.apache.catalina.startup.Catalina.load(Catalina.java:675)
geoserver-1  |          at org.apache.catalina.startup.Catalina.start(Catalina.java:727)
geoserver-1  |          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
geoserver-1  |          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
geoserver-1  |          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
geoserver-1  |          at java.base/java.lang.reflect.Method.invoke(Method.java:569)
geoserver-1  |          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
geoserver-1  |          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
geoserver-1  | 17-Jun-2025 07:24:47.358 SEVERE [main] org.apache.catalina.startup.Catalina.start Cannot start server, server instance is not configured
geoserver-1 exited with code 1

Do I need to install Tomcat separately from the docker images into local machine and mount the server config from Tomcat to docker container? If not, how do I fix the issue?

Hi there,

I see that your composition is using the SNAPSHOT version of the next release. I suggest you to only reference published release, like the 2.27.1. It works perfectly.

Regards
Alexandre

1 Like

Thanks @AlexGacon for the suggestion!

Regarding my problem. I have an environment variable, called in the server.xml of tomcat, that has ampersand character “&” and it is conflicting with the syntax of the server.xml.

I eliminated the & character and is now running.

Thank you!