1

I am following lynda Docker tutorials and performing stuff related to docker compose file.

This is my docker-compose.yml file.

more docker-compose.yml version: '3' services: web: image: jboss/wildfly volumes: - ~/deployments:/opt/jboss/wildfly/standalone/deployments ports: - 8080:8080 

As per authors, I am trying to copy webapp.war file to deployments/ folder giving me error. It look like volume mapping for the docker file is not working.

cp /home/user/Demos/docker-for-java/chapter2/webapp.war deployments/ cp: cannot create regular file ‘deployments/’: Not a directory

docker-compose ps Name Command State Ports -------------------------------------------------------------------------------- helloweb_web_1 /opt/jboss/wildfly/bin/sta ... Up 0.0.0.0:8080->8080/tcp 

1 Answer 1

1

I think you might be misinterpreting tutorial. I haven't seen the tutorial itself, but checking the documentation for the WildFly Docker image here there's a mention that you need to extend base image and add your war file inside:

To do this you just need to extend the jboss/wildfly image by creating a new one. Place your application inside the deployments/ directory with the ADD command (but make sure to include the trailing slash on the deployment folder path, more info). You can also do the changes to the configuration (if any) as additional steps (RUN command).

This means that you need to create a Dockerfile with approximately this contents (change your-awesome-app.war with the path to your war file):

FROM jboss/wildfly ADD your-awesome-app.war /opt/jboss/wildfly/standalone/deployments/ 

After that you need to change you docker-compose.yml to build from your Dockerfile instead of using jboss/wildfly (note the use of build: . instead of image: jboss/wildfly):

version: '3' services: web: build: . ports: - 8080:8080 

Try that and comment if you run into any issues

Sign up to request clarification or add additional context in comments.

1 Comment

Thnx for suggestion. No, I'ven't misinterpreted the tutorial, followed exactly the same steps. Because docker-compose.yml file having the enrty for the volume mapping and when I execute the docker-compose up -d network drive should have mounted and I should be able to copy .war file to /deployments folder

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.