My working environment is macOS 12.
UPDATE: Ubuntu 20.04 has the same issue.
I'm trying to create a Docker container and mount a volume to it.
Here's what I tried:
public class Test {
public static void main(String[] args) throws IOException, InterruptedException {
var p = Runtime.getRuntime().exec("docker run -d -it -v \"/Users/myname/Documents/MC_Servers/BungeeCord/plugins/PlayerServers/servers/OpenSourcee:/data\" -p 32348:32348 -e TYPE=PAPER -e ONLINE_MODE=false -e SERVER_PORT=32348 -e EULA=TRUE -e VERSION=1.8.8 --name OpenSourcee itzg/minecraft-server", null, null);
// Read the output from the command
var reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
System.out.println(p.waitFor());
}
}
The output seems to be empty, and the exit value is 125
Interestingly enough, if I do the same, but without
-v \"/Users/myname/Documents/MC_Servers/BungeeCord/plugins/PlayerServers/servers/OpenSourcee:/data\"
it works without any issues. As an example, the following works:
public class Test {
public static void main(String[] args) throws IOException, InterruptedException {
var p = Runtime.getRuntime().exec("docker run -d -it -p 32348:32348 -e TYPE=PAPER -e ONLINE_MODE=false -e SERVER_PORT=32348 -e EULA=TRUE -e VERSION=1.8.8 --name OpenSourcee itzg/minecraft-server", null, null);
// Read the output from the command
var reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
System.out.println(p.waitFor());
}
}
I did also try to manually execute the command from the first block and it works without any issues, however, it does not work from Java. I'm guessing it may be some kind of permission issue or something...?