示例#1
0
def getDockerExecutable():
  """ Return the name of the docker executable or None if docker is not installed. """
  if executablePath.which("docker.io"): # Docker is called docker.io on debian.
    return "docker.io"
  if executablePath.which("docker"):
    return "docker"
  return None
示例#2
0
文件: docker.py 项目: jig/subuser
def getDockerExecutable():
    """ Return the name of the docker executable. Exits and displays a user friendly error message if docker is not setup correctly. """
    if executablePath.which("docker.io"):  # Docker is called docker.io on debian.
        return "docker.io"
    if executablePath.which("docker"):
        return "docker"
    sys.exit(
        """Error: Docker is not installed.

For instalation instructions see <https://www.docker.io/gettingstarted/#h_installation>"""
    )
    if not os.path.exists("/var/run/docker.pid"):
        sys.exit(
            """Error: Docker is not running.  You can launch it as root with:

# docker -d
"""
        )

    username = getpass.getuser()
    if not username in grp.getgrnam("docker").gr_mem:
        sys.exit(
            """Error: You are not a member of the docker group.

To learn how to become a member of the docker group please watch this video: <http://www.youtube.com/watch?v=ahgRx5U4V7E>"""
        )
示例#3
0
def getSubuserCommandPath(command):
  builtInCommandPath = os.path.join(_getSubuserCommandsPath(),command)
  if os.path.exists(builtInCommandPath):
    return builtInCommandPath
  else:
    externalCommandPath = executablePath.which("subuser-"+command)
    return externalCommandPath
示例#4
0
def getSubuserCommandPath(command):
  builtInCommandPath = os.path.join(paths.getSubuserCommandsDir(),command)
  if os.path.exists(builtInCommandPath):
    return builtInCommandPath
  else:
    externalCommandPath = executablePath.which("subuser-"+command)
    return externalCommandPath
示例#5
0
def getSubuserCommandPath(command):
  builtInCommandPath = os.path.join(paths.getSubuserCommandsDir(),command)
  if os.path.exists(builtInCommandPath):
    return builtInCommandPath
  elif os.path.exists(builtInCommandPath+".py"):

    return (builtInCommandPath+".py")
  else:
    externalCommandPath = executablePath.which("subuser-"+command)
    return externalCommandPath
示例#6
0
def getDockerExecutable():
    """ Return the name of the docker executable. Exits and displays a user friendly error message if docker is not setup correctly. """
    if executablePath.which(
            "docker.io"):  # Docker is called docker.io on debian.
        return "docker.io"
    if executablePath.which("docker"):
        return "docker"
    sys.exit("""Error: Docker is not installed.

For instalation instructions see <https://www.docker.io/gettingstarted/#h_installation>"""
             )
    if not os.path.exists("/var/run/docker.pid"):
        sys.exit(
            """Error: Docker is not running.  You can launch it as root with:

# docker -d
""")

    username = getpass.getuser()
    if not username in grp.getgrnam("docker").gr_mem:
        sys.exit("""Error: You are not a member of the docker group.

To learn how to become a member of the docker group please watch this video: <http://www.youtube.com/watch?v=ahgRx5U4V7E>"""
                 )