-
Notifications
You must be signed in to change notification settings - Fork 124
port is already allocated without running containers #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Problem remains even after uninstall beta version and install stable. |
Also seeing this when my mac sleeps and this is woken up; containers are killed (issue #85) and then when trying to restart containers using |
same here, reset to factory defaults would fix that. |
In addition to this and #85, it's making development very difficult. Any additional information/assistance I can provide to help? |
The same issue on OSX 10.11.6 with Docker 1.12.1 stable |
@sergeyklay could you upload diagnostics from a reproduction on 1.12.1? The diagnostics in 1.12.1 are much better than in 1.12.0, in particular they include a process list from inside the VM which would show ports being held open from there. (The port opening is requested by the docker engine by running a proxy process, which communicates with a server on the Mac which actually opens the port. When the process inside the VM quits, the ports are closed on the Mac) It would also really help if someone could help me reproduce this. Has anyone got a simple script or compose file they could share? Every time I try to repro this it always seems to work as expected :( For example if I run an
and then in another terminal
I can see the ports bound via
I can then Control+C the For a more complicated example, if I clone the example-voting-app:
I can repeatedly bring it up and down with
with no error :( |
Just wanted to add, I ran into this as well, but on different ports.
This was with no containers running, and even after removing all containers, restarting docker, and then finally reinstalling docker for mac. Restoring factory settings and setting everything up again now. Fortunately, that part is all automated... but it's a very odd problem. |
I don't know what that was, but restoring to factory defaults did the trick! |
Ya, and removes all images, containers, volumes, networks, etc |
This happen again after shutdown computer while closing docker. On linux users have reported that after remove The thing is on Mac I can't find this file. On linux the path is |
Just ran into the same issue. After trying out some things, i found it. I did not want to reset my machine.
|
I already tried by stopping all the containers, even removing all of them. The reset is a desperate measure but is the only thing that kinda works, as I say before by far is not the best but It is what it is at the moment. |
@oliverhr In my case stopping containers was not sufficient. Cleaning up the remaining networks and after that stopping and starting docker fixed it. The containers are fine, it's just the lingering networks that keep blocking the ports. |
Similar problem here. Container using port 3000/3001 cannot be started: "Bind for 0.0.0.0:3001 failed: port is already allocated". When I remove port 3001, I get the same message for port 3000. Netstat shows this: I start container with "-p 0.0.0.0:3000:3000 -p 0.0.0.0:3001:3001" options. I am on a slow internet connection, so removing docker folder and recreating all images is not really an option at the moment. The only way I can get around this is using a different port: "-p 0.0.0.0:4000:3000 -p 0.0.0.0:4001:3001". There must be some way to release these ports?? docker version: Server: |
@oliverhr what's your new diagnostic ID? I can only see the logs related to your initial issue, where you hit an osxfs bug which was fixed after Beta21: Detected symptom of problem 'invariant-violated' in 269F8ACE-C09C-4FB4-856C-8208C92B0020/20160809-155640. An invariant within the code of one of the components was not held. Docker needs to be restarted. May be related to #89 The following log matches:
|
The same issue on OSX 10.12 (build: 16A323) with Docker version: 1.12.1 (2d5b4d9). After rebooting MAC.
logs: /tmp/79ABB4D6-AC97-498B-9C28-BFA79AE6C99E/20161018-121008.tar.gz Suggestions of roelvanhintum no result.
Restoring to factory defaults did the trick! But this solution is in the forehead, as the situation is repeated often enough, including other ports which are specified in the docker-compose.yml file |
We've been facing the same issue for weeks and it's seriously slowing us down. Here's a diagnostic ID from one of my co-workers: 8B5B573A-EEA7-447B-8DCD-3BC115AFF40A We can provide many more if needed :-) Is there anything else we can do to help you reproduce this issue? |
A small update: this could be related to the issue [moby/moby#25981] -- under some circumstances the docker engine keeps a port allocated even though there is no associated container. Hopefully the upcoming 1.12.3 will have some fixes in this area. On the linked ticket some people reported success with a workaround: (NB I've had to tweak this to remove mention of First get a shell inside the VM:
Next delete the kv store which contains the network information inside the VM:
Next logout of the shell in the VM and restart the app. With luck this avoids the need to perform a factory reset. Let me know if this helps (or not). I'll let you know when there's an update with some relevant patches in. |
Hooray! Correct! There is no need to throw off to the factory settings ... Thank you! BA3EF875-A019-4578-9D7C-C0212AA758F2 Docker for Mac: version: 1.12.1 (2d5b4d9) |
After putting together pieces from various sources, this is the whole process that worked for me:
|
@pgcp I think that does not work for |
Same problem with Version 1.12.3-beta29.2 (13499)
|
Update: With Version 1.12.3-beta29.2 I was able to fix doing this:
Hope this help. |
I am having this issue on a Mac with docker 1.13.0. I ran diagnostics and uploaded my tar. My diagnostic ID is 44F38709-1B25-4D2F-A458-C8C5D72184E7. Also @oliverhr I was unable to do step one of your work around. In particular the command worked, but it didn't seem to have any effect on the state. Edit: Reseting to Default did NOT resolve the issue. |
@cloutiertyler can you give a bit more details on the things you were trying to do and the error that you got? I cannot see anything obvious in your logs so any hint would be appreciated. |
I'm running Docker for Mac Version 1.13.0 (15072) on Sierra 10.12.2 and I'm having this problem as well. I've reset docker and have the issue running the following container.
With the output
|
@cloutiertyler actually your docker logs contain an interesting stack trace:
It's probably an upstream bug, I will report that upstream. |
@freneticmonkey can you please open a new issue with a diagnostic ID? Thanks! |
@cloutiertyler can you share a way to reproduce the error that you had? |
The go panic has been reported upstream: moby/moby#30641 |
@samoht I apologize for the radio silence, I've been quite busy the last few days. Unfortunately I haven't found a way to reliably reproduce the bug. What I do know is that it happened after I sent an interrupt to forcibly stop my docker containers. |
I'm having the same issue as @cloutiertyler does. Even reset to defaults doesn't help me. My diagnostics ID: DC6D6138-681A-4F76-B826-A50AD62CF90D |
I am getting the same error. Docker ps -a does not show the reported port as being allocated, but compose still complains: Diagnostics: 17F28038-B039-469E-9BE5-118D85A94A03/2017-12-11_12-46-21 Windows 10, latest update |
sudo service docker restart |
I wonder why this issue is closed when this issue persists in the current "stable" release. After starting containers with host ports, and then stopping and removing (!) them, the ports seems to be still allocated and I need to restart the docker daemon in order to start new container with the same host port. EDIT: This is also not fixed in the edge version. To reproduce this, just run container with host port set, then kill that container and delete it. Then run another container with this command:
and you will see that host port still allocated in Docker VM. |
We also still have this problem, sometimes even docker restart is not enough, I have to manually kill VPNKit process. |
This is weird, but I've resolved it restarting my machine and killing the pid
output 👇 ** tcp4 0 0 .5432 . LISTEN 131072 131072 552 0*
|
@mfojtik I believe the issue was closed because the specific bug which could cause the symptom was believed fixed. If this symptom still occurs, there must be a separate problem in the code somewhere. Could you open a fresh issue with a set of diagnostics and set of repro instructions? |
I've locked this issue since it's become too noisy and too difficult to disentangle the different reports. Please do report separate issues and feel free to link them to this one if you think they're related. |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Expected behavior
Container creation
Actual behavior
Error: port is already allocated
Information
Diagnostic ID: 269F8ACE-C09C-4FB4-856C-8208C92B0020
Docker for Mac: 1.12.0-beta21 (Build 11019)
macOS: Version 10.11.6 (Build 15G31)
[OK] docker-cli
[OK] app
[OK] moby-syslog
[OK] disk
[OK] virtualization
[OK] system
[OK] menubar
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux
Steps to reproduce
-p
with any port - in my case two containers nginx (80, 443) and a node app running on 10011Result for command

docker ps -a
:Portscan on 0.0.0.0 with docker running - But without running any container

Portscan on 0.0.0.0 without docker:

The text was updated successfully, but these errors were encountered: