You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dockerClient.containers.create(..., ports={...: None}) does not work in docker client 3.2.0 and upwards #2792
The keys of the dictionary are the ports to bind inside the container, either as an integer or a string in the form port/protocol, where the protocol is either tcp, udp, or sctp.
So you have to inform the protocol like {"11234/tcp": None}.
I could not reproduce the empty list on Linux, so I suggest you print the portmap variable to be able to see the entire dictionary.
Have a nice day :)
PS: I'm preparing a windows machine to try to reproduce the problem.
Activity
feliperuhland commentedon Mar 25, 2021
Hi @bentheiii
First of all, thank you for the code snippet.
The containers documentation explain how ports should be used:
So you have to inform the protocol like{"11234/tcp": None}.I could not reproduce the empty list on Linux, so I suggest you print the
portmapvariable to be able to see the entire dictionary.Have a nice day :)
PS: I'm preparing a windows machine to try to reproduce the problem.
bentheiii commentedon Mar 25, 2021
Hi and thanks for the quick reply, I can reproduce the problem on multiple machines (windows and mac)
portmap={'11234/tcp': [], '6379/tcp': None}feliperuhland commentedon Mar 25, 2021
Hi @bentheiii
Sorry to ask you again, but the attempt to recover my windows machine was a total failure.
Could you add a print right before reloading the container to be sure that is happening since the container creation?
In the meanwhile, I will figure out how to debug that.
Thanks and have a nice day :)
bentheiii commentedon Mar 30, 2021
Hello, I have run the following code:
this is the result:
filtering only
["NetworkSettings"]["Ports"]evaluates to:EDIT: I'm just now noticing the strange behaviour, will investigate further if I have time
bentheiii commentedon Mar 30, 2021
It appears that the issue can be fixed by introducing a small delay (even a function call) between the
startandreloadcallsoutput:
feliperuhland commentedon Mar 30, 2021
My output (linux) was:
A portmap {} B portmap {'11234/tcp': [{'HostIp': '0.0.0.0', 'HostPort': '49155'}], '6379/tcp': None} C portmap {'11234/tcp': [{'HostIp': '0.0.0.0', 'HostPort': '49155'}], '6379/tcp': None}@ulyssessouza could you try that as well?
Thanks @bentheiii @ulyssessouza
feliperuhland commentedon Mar 31, 2021
Hi @bentheiii
I´m sorry to ask you again, but could you try to play around with
container.reload(timeout=XXXXX)?Unfortunately, that issue doesn't happen on Linux, and Docker doesn´t work inside a Windows VM.
Thanks again, and have a nice day :)
aviramha commentedon Apr 8, 2021
I think this is a Docker Desktop issue, so this should be in the docker for-mac/for-win repository?