def shell(self, cmd=None): try: attrs = self.cli.containers.get(self.conf["dockName"]).attrs xPort = attrs["NetworkSettings"]["Ports"]["14500/tcp"][0]["HostPort"] except (docker.errors.NotFound, KeyError): xPort = None if not xPort and platform.system() == "Windows" and "DISPLAY" not in os.environ: # On Windows if no DISPLAY environment is set we assume a sensible default os.environ["DISPLAY"] = "127.0.0.1:0.0" if xPort: LOG.warning("X11 web browser access: http://localhost:{port}".format(port=xPort)) execReturn("ssh", self.getSshCommand() + (cmd if cmd else []))
def rootShell(self): execReturn("docker", ["docker", "exec", "-it", self.conf["dockName"], "/bin/bash"])
def shell(self, cmd=None): if platform.system() == "Windows" and "DISPLAY" not in os.environ: # On Windows if no DISPLAY environment is set we assume a sensible default os.environ["DISPLAY"] = "127.0.0.1:0.0" execReturn("ssh", self.getSshCommand() + (cmd if cmd else []))