Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit e75fd61

Browse files
committed
add README, use default /bin/sh
1 parent 37e087d commit e75fd61

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
=======
22
NSEnter
33
=======
4+
5+
Requires Python 3.4.
6+
7+
Install::
8+
9+
python3 setup.py install
10+
11+
Example usage::
12+
13+
docker run -d --name=redis -t redis
14+
sudo nsenter --all --target=`docker inspect --format '{{ .State.Pid }}' redis` /bin/bash
15+

nsenter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def main():
4949
for ns in NAMESPACE_NAMES:
5050
parser.add_argument('--{}'.format(ns), action='store_true', help='Enter the {} namespace'.format(ns))
5151
parser.add_argument('--all', action='store_true', help='Enter all namespaces')
52-
parser.add_argument('command')
52+
parser.add_argument('command', nargs='*', default='/bin/sh')
5353

5454
args = parser.parse_args()
5555

@@ -60,7 +60,7 @@ def main():
6060
namespaces.append(Namespace(args.target, ns))
6161
for ns in namespaces:
6262
stack.enter_context(ns)
63-
os.execl(args.command, args.command)
63+
os.execl(args.command[0], *args.command)
6464

6565

6666
if __name__ == '__main__':

0 commit comments

Comments
 (0)