Skip to content

Commit 88fda0a

Browse files
kylecarbsKatie Hornejawnsy
authored
chore: Add solution for Docker problems (#369)
* chore: Add solution for Docker problems Co-authored-by: Katie Horne <katie@coder.com> Co-authored-by: Jonathan Yu <jonathan@coder.com>
1 parent 9b9e914 commit 88fda0a

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
title: Docker key storage issues
3+
description: Learn how to solve Docker key storage issues inside Coder workspaces.
4+
---
5+
6+
When using Coder, you may encounter the following error:
7+
8+
```console
9+
docker: Error response from daemon: OCI runtime create failed:
10+
container_linux.go:370: starting container process caused:
11+
process_linux.go:459: container init caused: join session keyring:
12+
create session key: disk quota exceeded: unknown.
13+
```
14+
15+
## Why this happens
16+
17+
The kernel allocates a system key for each container created. When lots of
18+
developers are sharing the same instance, you may run into limits on the number
19+
and size of keys each user can have.
20+
21+
## Resolution
22+
23+
To fix this error, you can increase `maxkeys` and `maxbytes`. These are global
24+
settings that apply to *all* users sharing the same system. You can modify this
25+
by adding the following to the `sysctl` configuration file:
26+
27+
```console
28+
sudo sysctl -w kernel.keys.maxkeys=20000
29+
sudo sysctl -w kernel.keys.maxbytes=400000
30+
```
31+
32+
Alternatively, you can use a DaemonSet with `kubectl apply` to make changes to
33+
`sysctl`:
34+
35+
```yaml
36+
apiVersion: apps/v1
37+
kind: DaemonSet
38+
metadata:
39+
name: increase-limits
40+
namespace: kube-system
41+
labels:
42+
app: increase-limits
43+
k8s-app: increase-limits
44+
spec:
45+
selector:
46+
matchLabels:
47+
k8s-app: increase-limits
48+
template:
49+
metadata:
50+
labels:
51+
name: increase-limits
52+
k8s-app: increase-limits
53+
annotations:
54+
seccomp.security.alpha.kubernetes.io/defaultProfileName: runtime/default
55+
apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default
56+
spec:
57+
nodeSelector:
58+
kubernetes.io/os: linux
59+
initContainers:
60+
- name: sysctl
61+
image: alpine:3
62+
command:
63+
- sysctl
64+
- -w
65+
- kernel.keys.maxkeys=20000
66+
- kernel.keys.maxbytes=400000
67+
resources:
68+
requests:
69+
cpu: 10m
70+
memory: 1Mi
71+
limits:
72+
cpu: 100m
73+
memory: 5Mi
74+
securityContext:
75+
# We need to run as root in a privileged container to modify
76+
# /proc/sys on the host (for sysctl)
77+
runAsUser: 0
78+
privileged: true
79+
readOnlyRootFilesystem: true
80+
capabilities:
81+
drop:
82+
- ALL
83+
containers:
84+
- name: pause
85+
image: k8s.gcr.io/pause:3.5
86+
command:
87+
- /pause
88+
resources:
89+
requests:
90+
cpu: 10m
91+
memory: 1Mi
92+
limits:
93+
cpu: 100m
94+
memory: 5Mi
95+
securityContext:
96+
runAsNonRoot: true
97+
runAsUser: 65535
98+
allowPrivilegeEscalation: false
99+
privileged: false
100+
readOnlyRootFilesystem: true
101+
capabilities:
102+
drop:
103+
- ALL
104+
terminationGracePeriodSeconds: 5
105+
```
106+
107+
At a later point, you can delete the DaemonSet by running:
108+
109+
```console
110+
$ kubectl delete --namespace=kube-system daemonset increase-limits
111+
daemonset.apps "increase-limits" deleted
112+
```
113+
114+
However, note that the setting will persist until the node restarts or another
115+
program sets the `kernel.keys.maxkeys` and `kernel.keys.maxkeys` settings.

manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@
354354
"children": [
355355
{
356356
"path": "./guides/troubleshooting/inotify-watch-limits.md"
357+
},
358+
{
359+
"path": "./guides/troubleshooting/docker-problems.md"
357360
}
358361
]
359362
}

0 commit comments

Comments
 (0)