Shahid Ghafoor
Shahid Ghafoor

Reputation: 3103

Permission to war file in jboss wildfly docker container

I am using CentOS 7 . I have pull the image from docker hub

https://hub.docker.com/r/jboss/wildfly/

and take war from the

https://github.com/arun-gupta/docker-for-java/tree/master/chapter2

the run the following command

docker run -it --name=wf -p 8080:8080 -v /home/admin/webapp.war:/opt/jboss/wildfly/standalone/deployments/webapp.war jboss/wildfly

it giving me permission denied on webapp.war

ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0008: Failed checking whether /opt/jboss/wildfly/standalone/deployments/webapp.war was a complete zip: java.io.FileNotFoundException: /opt/jboss/wildfly/standalone/deployments/webapp.war (Permission denied)

How can I give permission to wepapp.war file without any changes made in dockerfile?

Upvotes: 3

Views: 4273

Answers (1)

VonC
VonC

Reputation: 1324935

Try instead making your own image, as suggested in jboss-dockerfiles/wildfly issue 19

There are two way to fix it:

Change the owner of the file after adding it to the image with chown (but this is ugly as hell...)

FROM jboss/wildfly
ADD your-awesome-app.war /opt/jboss/wildfly/standalone/deployments/ 
USER root
RUN chown jboss:jboss /opt/jboss/wildfly/standalone/deployments/*
USER jboss

Change the permissions on the host's your-awesome-app.war file:

chmod 755 your-awesome-app.war

This will make it readable to the jboss user inside of the container and it'll be able to unpack it.

Upvotes: 5

Related Questions