From b9efde90e933e7b9e1e38a391fecde92e6ee8345 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Mon, 22 May 2017 23:57:40 -0700 Subject: [PATCH] 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. --- repo2docker/app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repo2docker/app.py b/repo2docker/app.py index df78e312..59b71963 100644 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -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'))