Skip to content
vast-cow's blog
Go back

Docker Wrapper Command for Interactive, Host-Networked Runs with Local Home and Working Directory Mounts

Edit page
  1. Interactive and ephemeral execution: Runs an interactive container (-it) and automatically removes it on exit (--rm).
  2. Host-like connectivity and filesystem context: Uses the host network stack (--network host) and binds the user’s home directory into both the same path and /root, while setting HOME accordingly (-v ... -e HOME=...).
  3. Runs from the current directory and forwards inputs: Sets the container working directory to the current directory (-w "$PWD") and passes through any additional Docker args and image/command parameters ("$@").
docker run -it --rm --network host -v "$HOME":"$HOME" -v "$HOME":/root -e HOME="$HOME" -w "$PWD" "$@"

Edit page
Share this post:

Comments


Previous Post
How to Clean Install Windows 11 on a MacBookPro14,2
Next Post
Recreating a bcache Backing Device with a New Block Size (Cache Device Not Used)