This is what I tried:
Dockerfile:
ENTRYPOINT go test ./tests -v .>/outputs/report.txt
Command line:
docker run test -v /outputs:/outputs
I expect that the newly generated report.txt will be available in the host in the same directory. What am I missing here?
I think that you almost made it.
Try to map the volume before image name.
Instead:
docker run test -v /outputs:/outputs
Use:
docker run -v /outputs:/outputs test
This command will bind your local
/outputs
with the/outputs
in the container. And remember, all commands after image name will pass acommand
to the container.For more information see: Docker run command docs and Docker volume docs