#!/bin/sh -eo pipefail docker run --rm -v"$PWD":/usr/src/myapp -w /usr/src/myapp java:7 javac Add.java
javac: file not found: Add.java Usage: javac <options> <source files> use -help for a list of possible options Exited with code 2
Can please check and advice what is wrong in the code. and why it has thrown error.
Your first -v volume statement is missing a space after the switch, so I wonder if this might be a syntax error
But, more importantly, on-host volumes don’t work in CircleCI. That’s because CircleCI intervenes in your Docker system to spin containers up on remote machines, and volumes don’t work across LAN connections. Search for “Docker volume” in this forum to see plenty of info about this (it happened to me too).
You can solve this in several ways:
Build your own Docker image that inherits from java:7 or groovy and copies in the files they need
If you need more than one container to communicate, run containers inside Docker Compose