Skip to content

Instantly share code, notes, and snippets.

@u1i
Created September 22, 2017 04:04
Show Gist options
  • Save u1i/5800c4fee56c22e433e0a6fcd25cadc3 to your computer and use it in GitHub Desktop.
Save u1i/5800c4fee56c22e433e0a6fcd25cadc3 to your computer and use it in GitHub Desktop.
import os
from docker import Client
from docker.utils import kwargs_from_env
kwargs = kwargs_from_env()
client = Client(**kwargs)
containers = client.containers()
builders = [c for c in containers if c['Image'] == 'u1ih/builder-runtime']
ids = [s['Id'] for s in builders]
urls = [s['Ports'][0]['IP'] + ':' + str(s['Ports'][0]['PublicPort']) for s in builders]
print urls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment