Send file from container to host

156 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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 a command to the container.

For more information see: Docker run command docs and Docker volume docs