1

I want to add my custom JBOSS_HOME but when i run my dockerfile it give me an error.

JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.

Unable to access jarfile

/home/shri/opt/jboss/wildfly/jboss-modules.jar

MY Dockerfile is:-

FROM jboss/wildfly   
MAINTAINER shri  
USER root  
ENV JBOSS_HOME /home/shri/opt/jboss/wildfly  
RUN mkdir -p  $JBOSS_HOME  
ADD jboss-modules.jar /home/shri/jboss/wildfly/  
USER jboss  

build dockerfile using:

docker build -t jboss .

Run dockerfile using:

docker run -p 8080:8080 jboss
Prags
  • 2,457
  • 2
  • 21
  • 38
shriyash Lakhe
  • 607
  • 1
  • 9
  • 21
  • Possible duplicate of [Override FROM image's ENV in Dockerfile](https://stackoverflow.com/questions/31834100/override-from-images-env-in-dockerfile) – Janez Kuhar Feb 09 '18 at 09:59
  • Possibly other error, I tried with your dockerfile and then run container with -it (like ssh into the container) given file structure was created and jar file was added. – Guru Feb 09 '18 at 10:08

2 Answers2

0

Dockerfile is fine, It is adding your custom jar file as well, Then where is the Problem?

I think the base image you are using setting working directory. to /opt/jboss and there is a default jboss file. I think by default it is picking this jar file.

Try changing working directory, Add this line (or similar) to your docker file after setting ENV and then try

WORKDIR ${JBOSS_HOME} 
Guru
  • 1,303
  • 18
  • 32
0

It's not obvious what you are trying to achieve.

The WildFly in the parent image you are building from is located in the /opt/jboss/wildfly, but you are

  • adding a custom jboss-modules.jar to /home/shri/jboss/wildfly/
  • and setting JBOSS_HOME to /home/shri/opt/jboss/wildfly which obviously doesn't exist.

If you want just to use the custom jboss-modules.jar, then the simplest is to overwrite the original one in /opt/jboss/wildfly/jboss-modules.jar and leave the JBOSS_HOME unchanged.

kwart
  • 3,154
  • 1
  • 21
  • 22
  • I do not understand why you are suggesting to over-write jar? Is it not sufficient to set JBOSS_HOME and keep jar there? – Guru Feb 12 '18 at 09:22
  • No it's not sufficient. The `jboss-modules.jar` is not enough - it's just something like kernel, you need to provide whole installation in the JBOSS_HOME (i.e. modules, configuration, deployment, ...) – kwart Feb 12 '18 at 09:46