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

use nsexec do export is not valid #1

Open
zhqqqy opened this issue Feb 7, 2022 · 1 comment
Open

use nsexec do export is not valid #1

zhqqqy opened this issue Feb 7, 2022 · 1 comment

Comments

@zhqqqy
Copy link

zhqqqy commented Feb 7, 2022

When I execute the below command

nsexec  -m /proc/46983/ns/mnt -p /proc/46983/ns/pid sh -c  "export"

It shows not the environment variables inside the container, but the local environment variables.

@YangKeao
Copy link
Member

YangKeao commented Feb 7, 2022

Yes. It is expected. Only the process forked from the first process of the container will have its environment variables. The nsenter has the same behavior.

Please try env "$(xargs -0 -L1 -a /proc/46983/environ)" nsexec -m /proc/46983/ns/mnt -p /proc/46983/ns/pid sh -c "export" . I'm not sure whether it will work perfectly 🤔

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