Repository navigation
Docker update cleared my .hosts file #758
Copy link
Copy link
Open
Labels
Description
Description
After I updated my Docker Desktop with winget to the version 4.33.1, the setup cleared my .hosts file under:
C:\Windows\System32\drivers\etc\hosts
I had several rules defined there. But after the setup, there was only the docker section left:
# Added by Docker Desktop
192.168.142.42 host.docker.internal
192.168.142.42 gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of sectionI recognized this, because my firewall warned me that my .hosts file was changed.
Reproduce
- Install Docker Desktop
- Put something in your
.hostsfile127.0.0.1 localhost ::1 localhost 192.168.0.1 my.router - Install a Docker Desktop update
- Check your host
.hostsand search for your entries.
They are gone now, and only the# Added by Docker Desktopblock is left.
Expected behavior
Docker should never overwrite the .hosts file. Especially without a warning.
I should only append its block on top or bottom of the file. If it needs an update to its configuration, it should try to clean up only the old docker configuration lines and never user-defined lines.
docker version
Docker Desktop 4.34.1 (166053)
OS: Windows 10 dedocker info
Client:
Version: 27.2.0
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.16.2-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.29.2-desktop.2
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.34
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
desktop: Docker Desktop commands (Alpha) (Docker Inc.)
Version: v0.0.15
Path: C:\Program Files\Docker\cli-plugins\docker-desktop.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.25
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.5
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.3.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.13.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe
Server:
Containers: 14
Running: 1
Paused: 0
Stopped: 13
Images: 67
Server Version: 27.2.0
Storage Driver: overlayfs
driver-type: io.containerd.snapshotter.v1
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 nvidia runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8fc6bcff51318944179630522a095cc9dbf9f353
runc version: v1.1.13-0-g58aa920
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.153.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 15.59GiB
Name: docker-desktop
ID: 2dd1665b-bfd3-492e-979f-6a6131673f8f
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=npipe://\\.\pipe\docker_cli
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: falseDiagnostics ID
Doesn't matter
Additional Info
No response
Reactions are currently unavailable
Activity
Ju-NXH commentedon Oct 6, 2026
This is still an issue in Docker Desktop 4.94.0
bsousaa commentedon Oct 19, 2026
@Ju-NXH can you please share a diagnostics id?