-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Whenever I copyFileFromContainer I always get an empty file, even though the same command using docker cp executes correctly.
I'm not sure how to provide more information, so here goes my configuration:
I have a docker image with the following start script, that generates the file server_pub.pem:
set -e
pd=`pwd`
cd src/main/resources/
openssl ecparam -name secp256k1 -genkey -noout -out server_prv.pem
openssl ec -in server_prv.pem -pubout -out server_pub.pem
cd $pd
java -jar server.jar
And when I run outside this image the copyFileFromContainer I get an empty file:
server = new GenericContainer("gennsecserver:latest").withExposedPorts(8080).waitingFor(Wait.forHttp("/api/ping"));
server.start();
Path tempDirectory = Files.createTempDirectory("");
String targetPubKeyPath = tempDirectory.toAbsolutePath().toString() + "/server_pub.pem";
String baseurl = "http://" + server.getContainerIpAddress() + ":" + server.getMappedPort(8080);
server.copyFileFromContainer("/home/secserv/src/main/resources/server_pub.pem", targetPubKeyPath);
But if I run docker cp I get a valid file:
docker cp 5dea99a39571:/home/secserv/src/main/resources/server_pub.pem ./