diff --git a/container b/container index 034cf4341..189dc3408 100755 --- a/container +++ b/container @@ -262,6 +262,13 @@ def parse_arguments(): subparser.add_argument('--image-size', default='12G', help='Disk image size to resize to after download') + # Print IP address + subparser = subparsers.add_parser( + 'ip', help='Print the IP address of the container.') + subparser.add_argument( + '--distribution', choices=distributions, default='testing', + help='Distribution of the container to print IP address') + # ssh subparser = subparsers.add_parser('ssh', help='SSH into the container') subparser.add_argument('--distribution', choices=distributions, @@ -926,6 +933,11 @@ def subcommand_up(arguments): _print_banner(arguments.distribution) +def subcommand_ip(arguments): + """Print the IP address of the container.""" + print(_get_ip_address(arguments.distribution) or '') + + def subcommand_ssh(arguments): """Open an SSH shell into the container.""" ip_address = _wait_for(lambda: _get_ip_address(arguments.distribution))