Exemple #1
0
 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 []))
Exemple #2
0
 def rootShell(self):
     execReturn("docker", ["docker", "exec", "-it", self.conf["dockName"], "/bin/bash"])
Exemple #3
0
 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 []))