unshare -mfp sh -c 'mount -tproc none /proc ; ls /proc'
That printed a /proc with only directories for PID 1 and PID 3, and exited, leaving me back in my old prompt in the root namespace, as expected.
Then I did
and I got back a listing without any PID directories. I was expecting my usual /proc full of processes. I had to mount proc again to fix things.
Why is this happening? How do I fix things so the /proc I mounted inside the PID namespace stays local to it?
I tried passing --mount-private to mount, but it didn't seem to have any effect.
I'm on Amazon Linux on util-linux 2.23.2.