nsenter: add --env for allowing environment variables inheritance
This commit adds support for the -e or --env option in nsenter, allowing a new process to inherit the environment va
If the option is not given, the environment variables will stay the same as in the current namespace.
Example:
Setup the namespace:
$ docker run -d -e PROJECT='util linux' --rm alpine sleep 10000
cb0b69aa7aec
$ docker inspect --format '{{ .State.Pid }}'
cb0b69aa7aec
470012
Enter the namespace:
$ nsenter --all -t 470012 --env env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=
cb0b69aa7aec
PROJECT=util linux
HOME=/root
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: u2386 <hugo.cavan2386@gmail.com>