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
Networking between my Mac OS host and running docker containers should not sporadically stop working.
Actual behavior
I'm experiencing network errors (connection resets, network errors) between my Mac host and all running docker containers. Restarting the containers does not resolve the problem. I have to restart docker to solve the problem. I've experienced this problem twice today, but had never experienced it before.
Information
macOS Version: macOS Mojave 10.14.2
Diagnostic logs
Steps to reproduce the behavior
It's hard to reproduce. Connectivity just ceases seemingly randomly, requiring me to restart docker. This is occurring on a fresh docker install as well.
Reacted by Ciaran Liedeman, Josh Heidebrecht, Ben Youngblood, Micah Henning, Alyssa, Bailey Everts, Manuel Tobar, Florian Hertnagel, Arturo Aparicio, Tobsucht and 42 more
Reacted by Reinis Ivanovs, Emmanuel Vuignier and Quint Stoffers
When the issue occurs, this is the error I receiving trying to run mongo on my host to connect with the monger server in my mongo docker container.
$ mongo
MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
2019-01-08T12:18:13.494-0600 E QUERY [js] Error: network error while attempting to run command 'isMaster' on host '127.0.0.1:27017' :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed
This is the issue I experienced trying to create an SQS queue on localstack:localstack running in a container:
Starting Localstack...
Started Localstack with hash 8a42a0e43174653894b4e1985d7d835f48b8da6ab46e7ecef57f66edaff4176d
Creating queue jobs at SQS endpoint http://localhost:4576/queue/jobs
An error occurred (502) when calling the CreateQueue operation (reached max retries: 4): Bad Gateway
Image versions:
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
localstack/localstack latest c583aaf39486 4 days ago 1.02GB
mongo latest 7177e01e8c01 10 days ago 393MB
I am also experiencing this issue. Same exact Docker for Mac version. The docker compose containers will start up fine after a system reboot or docker restart, but the network mapping to the host will stop responding after a (seemingly) random amount of time.
I can still bash into the containers, and they access each other through curl, so the docker sub-network seems to be fine, but there is no system host mapping. I get timeouts trying to access them from a browser.
I've allocated 16gb to docker and 6 cpus, so I don't think it's a resource issue. The stack uses roughly 6gb of memory.
Same problem here on all versions higher than 18.06.1-ce-mac73 (26764). For me, the network connections drop out when using the JVM debugger after about 60 seconds.
It defiantly seems load based. I was able to make it a day and overnight without network loss. I was only running one small web service. First time in a week I have been able to run longer than an hour or two.
@jeff-cook I'm not certain it is load related. I experienced similar symptoms with UDP packets failing to be bridged into the container. In each of the several cases the container ran for 24 hours or so and when returning to the office in the morning the networking to the container was dead. During the day the host would have constant use with periods of the CPU being driven hard. So, I suspect it is not load, but some other condition that triggers the bug.
My environment is a mac server with a static IP assigned, so it is not related to sleep or flaky wifi connections. Reverting to 18.06.1 seems to be a valid workaround, so far.
This issue occurred again, after 2 days of uptime, running Server Version: 18.06.1-ce.
I've determined that ingress network connections succeed (ie. I see UDP network packets arrive in the container). However, outbound connections from the container fail (ie. ping google.com doesn't receive any responses). Restarting the engine resolved the outbound connection issue.
I've recently started facing this same issue. I'm on docker 4.8.2 , macos 12.4 Monterey .
I've tried replacing docker.host.internal to my laptop's public IP but still no luck. Everything will work fine after docker restart and then after few minutes connection timeouts will start. :(
Does anybody found any workaround this issue?
seems like the for-win folks have a very similar issue as the for-mac peeps. I used a suggestion from this other thread docker/for-win#8861 and I can confirm that by downgrading docker desktop for mac to version 4.5.0 "fixes" the problem and I no longer have network issues. I tested for several days without any problems. Then upgraded back to the latest version and started getting timeouts and connection failures almost immediately again.
there must have been something that occurred between 4.5.0 and now that is causing networking issues.
The option mentioned in the previous post is now found in the Docker preferences in General under:
Use Virtualization framework
Seems to help, it's been 24 hours since I ticked the option and no more issues, while I'd typically lose connectivity 3 to 5 times a day. EDIT: never mind, still losing the connection.
My issue was is: I'd regularly lose the connection to some APIs from inside Docker. Regularly, my Python Flask app would no longer be able to connect to the OpenAI API (timeout) from Docker, curl from Docker would not be able either (timeout); BUT: curl calls from macOS would still work (so not an issue with the API), as would API calls to Azure from inside the Docker container. Restarting the container did not help. Had to restart Docker every time to restore proper connectivity. Did not know how to diagnose the issue.
So, doing some local development… In 3 hours of coding, had to restart the Docker app 10 times, because it'd lost connectivity as described in the previous post.
I love using Docker to aim for dev-prod parity, but at this pace it's getting counter-productive.
On macOS Monterey 12.6.2, docker version 20.10.22, docker desktop 4.16.2, and I'm experiencing this issue. Tried setting "useVpnkit": false but docker still hadn't re-started after 15 minutes, so I gave up on that approach.
I'd been disabling vpnkit to get around this issue for months, but as of Ventura 13.2 / Docker Desktop 4.16.2, docker will no longer start with "useVpnkit": false and this issue is as present as ever. Not sure what to do at this point; Docker is effectively useless for any stack that opens a significant number of connections on startup.
Switching to Orbstack resolved this issue for me. However I wanted to add a few things I tried which may or may not be helpful...
Running docker compose up with a single postgres db service - worked as expected I could connect to localhost:5432 without issue.
Running docker compose up with 2 services (or more) - network connectivity issues experienced. 10-20% success rate using the same localhost:5432 connection url as before.
I deleted containers, volumes, networks between runs using:
orbstack didn't seem to have the same issue mapping the container across the host network and was 100% reliable in comparison to docker-desktop which is essentially now obsolete for me as a result of its failure to reliably map containers to the relevant host/port so I can connect from the IDE to the database. Other containers didn't seem to have an issue as I was also running PgWeb as well as Postgres
Just another 5 cents.
If using Docker Desktop: pinning it to 1 CPU thread removes all problems (obviously at the expense of being slow asf), so it's a clear multithreading bug.
When using Colima it mostly works. Why mostly: still get random "connection reset" from time to time, pretty rarely though.
I suspect it's just OSX problem after all though because why would it be that similar for docker desktop and colima?
Obviously on my Linux dev machines nothing ever flaked in these tests.
Activity
micchickenburger commentedon Jan 8, 2019
When the issue occurs, this is the error I receiving trying to run mongo on my host to connect with the monger server in my mongo docker container.
This is the issue I experienced trying to create an SQS queue on
localstack:localstackrunning in a container:Image versions:
piniondna commentedon Jan 8, 2019
I am also experiencing this issue. Same exact Docker for Mac version. The docker compose containers will start up fine after a system reboot or docker restart, but the network mapping to the host will stop responding after a (seemingly) random amount of time.
I can still bash into the containers, and they access each other through curl, so the docker sub-network seems to be fine, but there is no system host mapping. I get timeouts trying to access them from a browser.
I've allocated 16gb to docker and 6 cpus, so I don't think it's a resource issue. The stack uses roughly 6gb of memory.
lduchesne commentedon Jan 8, 2019
I too had this problem and downgrading to Docker Community Edition 18.06.0 seemed to have fixed it. It might be related to #3360
schmurgon commentedon Jan 9, 2019
Same problem here on all versions higher than 18.06.1-ce-mac73 (26764). For me, the network connections drop out when using the JVM debugger after about 60 seconds.
onmomo commentedon Jan 10, 2019
Same Problem here: Diagnostics ID: 2D80AB9C-9218-4705-933D-0B9B7525F15A/20190104105334
Might be related to #3417
ivester commentedon Jan 10, 2019
Same problem here
retoheusser commentedon Jan 10, 2019
I experience this too...
jeff-cook commentedon Jan 10, 2019
I experience this as well. Same version.
docker version
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:47:43 2018
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:55:00 2018
OS/Arch: linux/amd64
Experimental: true
jeff-cook commentedon Jan 10, 2019
I have noticed that when it happens the CPU spikes. I have not figured out if the spike is a cause or a symptom.
jeff-cook commentedon Jan 11, 2019
It defiantly seems load based. I was able to make it a day and overnight without network loss. I was only running one small web service. First time in a week I have been able to run longer than an hour or two.
josh-h commentedon Jan 11, 2019
@jeff-cook I'm not certain it is load related. I experienced similar symptoms with UDP packets failing to be bridged into the container. In each of the several cases the container ran for 24 hours or so and when returning to the office in the morning the networking to the container was dead. During the day the host would have constant use with periods of the CPU being driven hard. So, I suspect it is not load, but some other condition that triggers the bug.
My environment is a mac server with a static IP assigned, so it is not related to sleep or flaky wifi connections. Reverting to 18.06.1 seems to be a valid workaround, so far.
jeff-cook commentedon Jan 11, 2019
It happened (76297123-260B-45B6-872E-9DE74FB5F950/20190111200619) even after a downgrade to Version 2.0.0.0-mac78 (28905) c404a62c3f
josh-h commentedon Jan 16, 2019
This issue occurred again, after 2 days of uptime, running
Server Version: 18.06.1-ce.I've determined that ingress network connections succeed (ie. I see UDP network packets arrive in the container). However, outbound connections from the container fail (ie.
ping google.comdoesn't receive any responses). Restarting the engine resolved the outbound connection issue.51 remaining items
merges commentedon Dec 30, 2021
Same problem. Is this being looked at by the maintainers at all?
rfay commentedon Dec 30, 2021
/lifecycle frozen
sageavaa commentedon May 31, 2022
I've recently started facing this same issue. I'm on docker 4.8.2 , macos 12.4 Monterey .
I've tried replacing docker.host.internal to my laptop's public IP but still no luck. Everything will work fine after docker restart and then after few minutes connection timeouts will start. :(
Does anybody found any workaround this issue?
razorman8669 commentedon Jun 25, 2022
seems like the for-win folks have a very similar issue as the for-mac peeps. I used a suggestion from this other thread docker/for-win#8861 and I can confirm that by downgrading docker desktop for mac to version 4.5.0 "fixes" the problem and I no longer have network issues. I tested for several days without any problems. Then upgraded back to the latest version and started getting timeouts and connection failures almost immediately again.
there must have been something that occurred between 4.5.0 and now that is causing networking issues.
alisterscott commentedon Jul 7, 2022
@pich4ya works on Macbook Air M1 - thank you 👍
fabswt commentedon Dec 10, 2022
The option mentioned in the previous post is now found in the Docker preferences in General under:
Seems to help, it's been 24 hours since I ticked the option and no more issues, while I'd typically lose connectivity 3 to 5 times a day.EDIT: never mind, still losing the connection.My issue
wasis: I'd regularly lose the connection to some APIs from inside Docker. Regularly, my Python Flask app would no longer be able to connect to the OpenAI API (timeout) from Docker, curl from Docker would not be able either (timeout); BUT: curl calls from macOS would still work (so not an issue with the API), as would API calls to Azure from inside the Docker container. Restarting the container did not help. Had to restart Docker every time to restore proper connectivity. Did not know how to diagnose the issue.fabswt commentedon Jan 11, 2023
So, doing some local development… In 3 hours of coding, had to restart the Docker app 10 times, because it'd lost connectivity as described in the previous post.
I love using Docker to aim for dev-prod parity, but at this pace it's getting counter-productive.
fabswt commentedon Jan 16, 2023
With useVpnkit=false takes forever to start. Tested on 4.15.0 to 4.16.1.
maxgurewitz commentedon Feb 3, 2023
On macOS Monterey 12.6.2, docker version 20.10.22, docker desktop 4.16.2, and I'm experiencing this issue. Tried setting
"useVpnkit": falsebut docker still hadn't re-started after 15 minutes, so I gave up on that approach.iancmcc commentedon Feb 10, 2023
I'd been disabling vpnkit to get around this issue for months, but as of Ventura 13.2 / Docker Desktop 4.16.2, docker will no longer start with
"useVpnkit": falseand this issue is as present as ever. Not sure what to do at this point; Docker is effectively useless for any stack that opens a significant number of connections on startup.iancmcc commentedon Feb 15, 2023
Downgrading to Docker Desktop 4.8.2 and reapplying the
"useVpnkit": falseconfiguration works around the issue for now.dimitrovs commentedon Jul 4, 2023
I was able to solve this problem by removing Docker Desktop for Mac and installing:
I also had to edit
~/.docker/config.jsonto remove the credsStore line.After that everything is working correctly.
robevansuk commentedon Jun 26, 2025
Switching to Orbstack resolved this issue for me. However I wanted to add a few things I tried which may or may not be helpful...
Running
docker compose upwith a single postgres db service - worked as expected I could connect to localhost:5432 without issue.Running
docker compose upwith 2 services (or more) - network connectivity issues experienced. 10-20% success rate using the same localhost:5432 connection url as before.I deleted containers, volumes, networks between runs using:
orbstack didn't seem to have the same issue mapping the container across the host network and was 100% reliable in comparison to docker-desktop which is essentially now obsolete for me as a result of its failure to reliably map containers to the relevant host/port so I can connect from the IDE to the database. Other containers didn't seem to have an issue as I was also running PgWeb as well as Postgres
pkit commentedon Aug 13, 2025
Just another 5 cents.
If using Docker Desktop: pinning it to 1 CPU thread removes all problems (obviously at the expense of being slow asf), so it's a clear multithreading bug.
When using Colima it mostly works. Why mostly: still get random "connection reset" from time to time, pretty rarely though.
I suspect it's just OSX problem after all though because why would it be that similar for docker desktop and colima?
Obviously on my Linux dev machines nothing ever flaked in these tests.