gvisor and network=host
- Dominant language
- Go
- Stars
- 19.3k
- Forks
- 2k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 264
Description
### Description
Hello,
I'm using gVisor with Docker Compose and have encountered a network-related issue. From what I understand, when you create a user-defined bridge network, Docker sets up a DNS system for the containers. However, containers running with runsc can't access this DNS system due to the sandbox, and as a workaround, I have been using static IPs for communication between services.
The problem arises when I set the network of runsc to host, as my services can then reach external resources like github.com. Without setting network=host, my services can communicate with each other, but they cannot reach external resources like GitHub. Then i get `fatal: unable to access 'https://github.com///': Could not resolve host: github.com`.This happens for every repo i try to access.
My question is: if I use network=host, do I lose all the security advantages that gVisor provides? Is there a safer workaround for allowing my containers to access external resources while maintaining gVisor's security benefits?
Thanks in advance for your help!
### Steps to reproduce
_No response_
### runsc version
```shell
runsc version release-20250113.0
spec: 1.1.0-rc.1
```
### docker version (if using docker)
```shell
Docker version 27.5.0, build a187fa5
```
### uname
_No response_
### kubectl (if using Kubernetes)
```shell
```
### repo state (if built from source)
_No response_
### runsc debug logs (if available)
```shell
```
Contributor guide
Assessment
This issue has not been assessed yet.