def docker_ip():
    """
    Returns the hosts and ports of the Docker containers.
    """
    # Retrieve a Docker client
    docker_client = get_docker_client()

    # Containers
    containers = get_docker_container_dicts(docker_client)
    container_status = get_docker_container_status(docker_client)
    docker_host = docker_client.host

    # PostGIS
    try:
        if container_status[POSTGIS_CONTAINER]:
            postgis_container = containers[POSTGIS_CONTAINER]
            postgis_port = postgis_container['Ports'][0]['PublicPort']
            print('\nPostGIS/Database:')
            print('  Host: {0}'.format(docker_host))
            print('  Port: {0}'.format(postgis_port))

        else:
            print('PostGIS/Database: Not Running.')
    except KeyError:
        # If key error is raised, it is likely not installed.
        print('PostGIS/Database: Not Installed.')
    except:
        raise

    # GeoServer
    try:
        if container_status[GEOSERVER_CONTAINER]:
            geoserver_container = containers[GEOSERVER_CONTAINER]
            geoserver_port = geoserver_container['Ports'][0]['PublicPort']
            print('\nGeoServer:')
            print('  Host: {0}'.format(docker_host))
            print('  Port: {0}'.format(geoserver_port))
            print('  Endpoint: http://{0}:{1}/geoserver/rest'.format(docker_host, geoserver_port))

        else:
            print('GeoServer: Not Running.')
    except __HOLE__:
        # If key error is raised, it is likely not installed.
        print('GeoServer: Not Installed.')
    except:
        raise

    # 52 North WPS
    try:
        if container_status[N52WPS_CONTAINER]:
            n52wps_container = containers[N52WPS_CONTAINER]
            n52wps_port = n52wps_container['Ports'][0]['PublicPort']
            print('\n52 North WPS:')
            print('  Host: {0}'.format(docker_host))
            print('  Port: {0}'.format(n52wps_port))
            print('  Endpoint: http://{0}:{1}/wps/WebProcessingService\n'.format(docker_host, n52wps_port))

        else:
            print('52 North WPS: Not Running.')
    except KeyError:
        # If key error is raised, it is likely not installed.
        print('52 North WPS: Not Installed.')
    except:
        raise
dataset/ETHPy150Open tethysplatform/tethys/tethys_apps/cli/docker_commands.py/docker_ip