From d4b0660b8d48046ad8b15c96eb17de1628818315 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 17 Dec 2023 16:04:02 -0800 Subject: [PATCH] add hint to use docker run instead of exec when catching root error fixes #1287 --- archivebox/config.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/archivebox/config.py b/archivebox/config.py index 775be8e4..0ee74922 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -1113,6 +1113,15 @@ def check_system_config(config: ConfigDict=CONFIG) -> None: stderr('[!] ArchiveBox should never be run as root!', color='red') stderr(' For more information, see the security overview documentation:') stderr(' https://github.com/ArchiveBox/ArchiveBox/wiki/Security-Overview#do-not-run-as-root') + + if config['IN_DOCKER']: + attempted_command = " ".join(sys.argv[:3]) + stderr('') + stderr(' {lightred}Hint{reset}: When using Docker, ArchiveBox commands should run with {green}docker run{reset} instead of {lightyellow}docker exec{reset}, e.g.:') + stderr(f' docker compose run archivebox {attempted_command}') + stderr(' or') + stderr(f' docker run -it -v ... -p ... archivebox/archivebox {attempted_command}') + raise SystemExit(2) ### Check Python environment