From 8d203723da8c8f1ef608e3791a11eca67f2b3975 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 3 Feb 2020 16:57:40 +0100 Subject: [PATCH] Added -a option for platydock to attach to the instance after booting it up --- platypush/platydock/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platypush/platydock/__init__.py b/platypush/platydock/__init__.py index 3db64d9e4..78ef654d3 100755 --- a/platypush/platydock/__init__.py +++ b/platypush/platydock/__init__.py @@ -221,6 +221,12 @@ def start(args): -p 18008:8008 -p 18009:8009 ''')) + parser.add_argument('-a', '--attach', action='store_true', default=False, + help=textwrap.dedent(''' + If set, then attach to the container after starting it up (default: false). + ''')) + + opts, args = parser.parse_known_args(args) ports = {} dockerfile = os.path.join(workdir, opts.image, 'Dockerfile') @@ -252,6 +258,9 @@ def start(args): print('Starting Platypush container {}'.format(opts.image)) subprocess.call(docker_cmd) + if opts.attach: + subprocess.call(['docker', 'attach', opts.image]) + def stop(args): parser = argparse.ArgumentParser(prog='platydock stop',