0

Attempting to run Tomcat in a Docker container on local Mac. Have set the Env Variables in the Container Config dialog of Intellij, and sure enough container seems to be looking for the file on startup but throws the error.

The file does indeed exist in that location, and permissions are r/w across the board.

Here is the Services Build Log produced when attempting to deploy the container:

Deploying 'TomcatContainer Image id: tomcat:latest'... Existing container found: 41dd80a5fed99c657955cb773db8526ae1120cde54ae66889554ba3213c4ef7d, removing... Creating container... Container Id: b14609a8cf48d619a3e1d7607410557456fb1a0fba40fed52b455b211e130147 Container name: 'TomcatContainer' Starting container 'TomcatContainer' 'TomcatContainer Image id: tomcat:latest' has been deployed successfully.

Environment Variables from Docker Inspect:

JAVA_HOME
Library/Java/JavaVirtualMachines/jdk-11.0.10.jdk/Contents/Home/

CATALINA_HOME
Users/blah/yadda/apache-tomcat-9.0.45

However running echo $JAVA_HOME and echo $CATALINA_HOME from the project folder return empty.

These below (from Inspect) appear to be defaults from Docker Image...but these files do not exist on my local; not sure what to make of this:

TOMCAT_NATIVE_LIBDIR
/usr/local/tomcat/native-jni-lib

LD_LIBRARY_PATH
/usr/local/tomcat/native-jni-lib

Thanks in advance.

1 Answers1

0

OK, once again, I answer myself.

There were some fundamental misconceptions in the question about a Docker container and the environment variables. It seems that these terms, in this context, refer to the environment within the container itself -- not the container interacting with the host OS, as I'd suspected.

Once I got that straight, I realized that I needed to get my WAR file into the container.

And it seemed that Intellij can do that via Services>Docker>Containers>Edit Configs>Volume Bindings; Host path: fully qualified path/Project/target; Container path: usr/local/tomcat/webapps and it works a treat, as they say.

This post covers that: Deploying Java webapp to Tomcat 8 running in Docker container