Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a setenv.sh causes startup issue. #157

Closed
pashworth opened this issue May 21, 2019 · 3 comments
Labels

Comments

@pashworth
Copy link

@pashworth pashworth commented May 21, 2019

I am using "FROM tomcat:9-jre8" in my dockerfile and then configure and build upon it.
When I add a setenv.sh to the bin directory I get an error message.
The setenv.sh just contains the following

#!/usr/bin/env bash
export CATALINA_OPTS="$CATALINA_OPTS -Xms4096m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx4096m"

The image starts but tomcat fails to start with the error

Invalid maximum heap size: -Xmx4096m
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I have had this working before but I see that the image was updated 5 days ago and it now seems to cause this issue.

Any help would be great
Thanks

@wglambert wglambert added the question label May 21, 2019
@wglambert

This comment has been minimized.

Copy link

@wglambert wglambert commented May 21, 2019

Are you running 64-bit Java?

$ docker run -dit --rm --name tomcat -e CATALINA_OPTS="-Xms4096m -Xmx4096m" tomcat
2b554c1d0c337cd00470a17ed5d22d45906ce99498978417117312395fd8b80a

$ docker exec -it tomcat bash

root@2b554c1d0c33:/usr/local/tomcat# apt update && apt install -y procps
. . .

root@2b554c1d0c33:/usr/local/tomcat# echo $(ps -p 1 -o args)
COMMAND /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 
-Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 
-Xms4096m -Xmx4096m -Dignore.endorsed.dirs= -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar 
-Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

-Xms4096m -Xmx4096m

If you want you could use an archive of the old image that worked for you
https://github.com/docker-library/repo-info/tree/e20248a2e790435c32d25c25acc728dbef9d1ca2/repos/tomcat/remote
The latest one from 12 days ago https://github.com/docker-library/repo-info/blob/e20248a2e790435c32d25c25acc728dbef9d1ca2/repos/tomcat/remote/latest.md

@pashworth

This comment has been minimized.

Copy link
Author

@pashworth pashworth commented May 22, 2019

Hi and thanks for the reply.
Yes I am running 64-bit java.

I tried the following.
1: Using the latest tomcat:9-jre8. I ran

docker run -dit --rm --name tomcat -e CATALINA_OPTS="-Xms4096m -Xmx4096m" tomcat:9-jre8
b3cdd11e264ca8a56173ba556b4d7342775417fe257a0623e5fcadef1b76625a

and following your other cmds I could see that the options were set correctly.
-Xms4096m -Xmx4096m

2: I created a new docker image from tomcat:9-jre8 as mentioned before and simply added the setenv.sh
I ran the cmd

docker run -dit --rm --name mytomcat -e CATALINA_OPTS="-Xms4096m -Xmx4096m" mytomcat
6a71ecec01ebe3f497c491e2ffea93e22f407670f84f9170d7796ea4141ede64

Next I tried

docker exec -it mytomcat bash
Error: No such container: mytomcat

then
docker ps showed no running container
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

I'm really not sure what is going on.
I will have a look at using an older image
Cheers
Phil

@pashworth

This comment has been minimized.

Copy link
Author

@pashworth pashworth commented May 23, 2019

Doh solved!
Is was because of the .sh being in windows format not unix and had CRLF in it.
Sorry

@pashworth pashworth closed this May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.