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
Copy file name to clipboardExpand all lines: devlog/2025-03-sandboxing-3.md
+49-6Lines changed: 49 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,25 +65,68 @@ The implementation now requires proper user namespace support to function, as th
65
65
66
66
## Production Deployment Requirements
67
67
68
-
For gVisor to work properly in production environments:
68
+
For gVisor to work properly in production environments, several host-level configurations are required:
69
69
70
-
1.**Docker Runtime Configuration**: Configure the Docker daemon with user namespace remapping using the `userns-remap` option in `/etc/docker/daemon.json`:
70
+
1.**Kernel Parameter Configuration**:
71
+
72
+
The `kernel.unprivileged_userns_clone` parameter controls whether unprivileged users can create user namespaces, which is essential for rootless containers:
73
+
74
+
```bash
75
+
# Check if the parameter exists
76
+
cat /proc/sys/kernel/unprivileged_userns_clone
77
+
78
+
# Enable unprivileged user namespaces (temporary)
79
+
sysctl -w kernel.unprivileged_userns_clone=1
80
+
81
+
# Enable unprivileged user namespaces (persistent)
This parameter is not available on all systems. Some distributions like Ubuntu have it enabled by default, while others may require kernel recompilation or may not support it at all.
86
+
87
+
2.**Docker Daemon Configuration**:
88
+
89
+
The Docker daemon needs to be configured to support user namespace remapping using the `userns-remap` option in `/etc/docker/daemon.json`:
90
+
71
91
```json
72
92
{
73
93
"userns-remap": "default"
74
94
}
75
95
```
96
+
97
+
This configuration maps the root user inside the container to a non-root user on the host, providing an additional layer of security. The "default" value creates a user and group named "dockremap" for this purpose.
98
+
99
+
After modifying this file, restart the Docker daemon:
100
+
101
+
```bash
102
+
systemctl restart docker
103
+
```
104
+
105
+
Note that enabling user namespace remapping affects all containers and may require additional configuration for volume mounts and other Docker features.
76
106
77
-
2.**Host-Level Configuration**: Enable user namespaces at the host level:
107
+
3.**User Namespace Mapping Tools**:
108
+
109
+
The `newuidmap` and `newgidmap` tools are required for mapping user and group IDs between the container and the host. These tools are typically provided by the `uidmap` package:
These tools are used by the container runtime to set up the user namespace mappings when a container is started. Without them, you'll see errors like `newuidmap failed: exit status 1` when attempting to use user namespaces.
82
120
83
-
3.**Container Runtime Flags**: Run containers with the appropriate flags:
121
+
4.**Container Runtime Flags**:
122
+
123
+
When running containers, use the appropriate flags to enable user namespace support and disable security features that might interfere with gVisor:
124
+
84
125
```bash
85
126
docker run --security-opt seccomp=unconfined --security-opt apparmor=unconfined --userns=host
86
127
```
128
+
129
+
These flags disable the seccomp and AppArmor security profiles, which might otherwise interfere with gVisor's operation, and enable host user namespace support.
0 commit comments