Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter --output doesn't write a file if using docker container #361

Open
thomasmerz opened this issue Mar 25, 2024 · 5 comments
Open

Comments

@thomasmerz
Copy link
Contributor

I'm using monolith in docker container and followed your installation instructions. But when I run this:

docker run --rm y2z/monolith https://web.de -o webde.html

I'm getting no file written at all on my local disk because the docker container has no volume ($PWD) mounted 😞

This can be fixed by this:

docker run --rm -v "$PWD:/mnt" y2z/monolith https://web.de -o /mnt/webde.html
@snshn
Copy link
Member

snshn commented Mar 25, 2024

Oh, wow, that's a really neat idea! The only downside I can think of, is that'd be to a detriment to the security aspect that Docker provides... e.g. if the $PWD happens to be ~, it'll just expose everything the user owns to whatever's in the container. Right now it has no ability to "infect" or "hijack" anything, but the -v thing would eliminate that sense of security.

@snshn
Copy link
Member

snshn commented Mar 25, 2024

I could make it create a temporary directory, e.g. .docker-monolith-temp-39t84tXb, put the -o file there, move it out of there to one level above, and then clean up by removing .docker-monolith-temp-39t84tXb after. That'd preserve the security, yet allow to use the -o option.

@thomasmerz
Copy link
Contributor Author

I'm doing this (-v "$PWD:/mnt") already for running shellcheck on my Macbook in a docker container - so it should be safe enough when someone normally wants the output to be written to a file relative to the current working directory 😄

docker run --rm -v "$PWD:/mnt" koalaman/shellcheck:latest -Calways --exclude=SC1090,SC1091 -S warning $*

@snshn
Copy link
Member

snshn commented Mar 25, 2024

Wow, that's some 1337 CLI stuff you have going in there. I'll try to do that thing with the temporary directory, will show what I have in a PR.

@thomasmerz
Copy link
Contributor Author

create a temporary directory

From a user's perspective: do whatever is neccessary to keep it as simple as possible when using it. So you would need to fix this line:
$DOCKER run --rm y2z/$PROG_NAME "$@"
to something like that?
$DOCKER run --rm -v "$PWD:/mnt" y2z/$PROG_NAME $url -o /mnt/$outputfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants