Print out the host port number in a log message

Eventually, we should actually be passing the port number
inside the docker container, after verifying that it is available
on the host. We can deal with races by doing the same thing that
ipython notebook does.
pull/7/head
yuvipanda 2017-05-22 23:57:40 -07:00
rodzic a0f539faaf
commit b9efde90e9
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -182,6 +182,12 @@ class Repo2Docker(Application):
ports={'8888/tcp': None},
detach=True
)
while container.status == 'created':
time.sleep(0.5)
container.reload()
host_port = container.attrs['NetworkSettings']['Ports']['8888/tcp'][0]['HostPort']
self.log.info('Port 8888 mapped to port %s on the machine docker is running on', host_port, extra=dict(phase='running'))
try:
for line in container.logs(stream=True):
self.log.info(line.decode('utf-8').rstrip(), extra=dict(phase='running'))