question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Random port binding not showing up in the .attr object

See original GitHub issue

I run a container and use the option ports={8000: None} in order to assign random port binding for this container. I then try to print the container.attr to look for what port did it bind to. It always get empty values: u'PortBindings': {u'8000/tcp': [{u'HostPort': u'', u'HostIp': u''}]}

I use the shell to make sure the container is running and binding ports correctly, and it works just fine. The container is indeed running the ports are bind correctly. But I need to access the port binding from the container object.

What is the problem here?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
shin-commented, Feb 6, 2017

I believe you will have to call container.reload() to refresh the container info after it’s allocated a port (i.e. once it’s been started).

0reactions
oiwncommented, Mar 20, 2017

Same issue.

Version 17.03.0-ce-mac2 (15654) docker-py (1.10.6)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can i add a port binding to a docker container while ...
With this project, VS binds a random port to the exposed port. enter image description here. Is there anyway i can add a...
Read more >
Configure Port Binding for iSCSI or iSER - VMware Docs
The port binding creates connections for the traffic between certain types of iSCSI and iSER adapters and the physical network adapters.
Read more >
Joint API - JointJS
An object containing at least an id of the Element to which we are ... group attribute comes to play when you're not...
Read more >
R.attr | Android Developers
Reference to a theme that should be used to inflate popups shown by widgets ... their own Context objects and not appear in...
Read more >
Jupyter Notebook Documentation - Read the Docs
By default the first notebook server starts on port 8888, ... Javascript and HTML output will not be displayed until they are regenerated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found