Skip to content

Instantly share code, notes, and snippets.

@stefanjacobs
Last active April 8, 2023 11:18
Show Gist options
  • Save stefanjacobs/99fa0f8c65e24532307406fe5255580d to your computer and use it in GitHub Desktop.
Save stefanjacobs/99fa0f8c65e24532307406fe5255580d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Create a script that enters a pids namespace and sets its environment variables, e.g. enter a docker container without `docker exec`
echo "sudo /usr/bin/nsenter --target \$1 --mount --uts --ipc --net --pid env -i - \$(sudo cat /proc/\$1/environ | xargs -0) bash" > enterDocker.sh; chmod +x enterDocker.sh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment