Created
September 8, 2017 10:25
-
-
Save u1i/7b2103e4d77410c357f2655886bc0b17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from docker import Client | |
from docker.utils import kwargs_from_env | |
kwargs = kwargs_from_env() | |
#kwargs['tls'].assert_hostname = False | |
client = Client(**kwargs) | |
containers = client.containers() | |
# get all containers that are based on this image | |
seleniums = [c for c in containers if c['Image'] == 'u1ih/ubuntu'] | |
# get all the published ports | |
urls = [s['Ports'][0]['IP'] + ':' + str(s['Ports'][0]['PublicPort']) for s in seleniums] | |
print urls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment