-
Notifications
You must be signed in to change notification settings - Fork 81
chore: Add solution for Docker problems #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
title: Docker key storage issues | ||
description: Learn how to solve Docker key storage issues inside Coder workspaces. | ||
--- | ||
|
||
When using Coder, you may encounter the following error: | ||
|
||
```console | ||
docker: Error response from daemon: OCI runtime create failed: | ||
container_linux.go:370: starting container process caused: | ||
process_linux.go:459: container init caused: join session keyring: | ||
create session key: disk quota exceeded: unknown. | ||
``` | ||
|
||
## Why this happens | ||
|
||
The kernel allocates a system key for each container created. When lots of | ||
developers are sharing the same instance, you may run into limits on the number | ||
and size of keys each user can have. | ||
|
||
## Resolution | ||
|
||
To fix this error, you can increase `maxkeys` and `maxbytes`. These are global | ||
settings that apply to *all* users sharing the same system. You can modify this | ||
by adding the following to the `sysctl` configuration file: | ||
|
||
```console | ||
sudo sysctl -w kernel.keys.maxkeys=20000 | ||
sudo sysctl -w kernel.keys.maxbytes=400000 | ||
``` | ||
|
||
Alternatively, you can use a DaemonSet with `kubectl apply` to make changes to | ||
`sysctl`: | ||
|
||
```yaml | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: increase-limits | ||
namespace: kube-system | ||
labels: | ||
app: increase-limits | ||
k8s-app: increase-limits | ||
spec: | ||
selector: | ||
matchLabels: | ||
k8s-app: increase-limits | ||
template: | ||
metadata: | ||
labels: | ||
name: increase-limits | ||
k8s-app: increase-limits | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/defaultProfileName: runtime/default | ||
apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default | ||
spec: | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
initContainers: | ||
- name: sysctl | ||
image: alpine:3 | ||
command: | ||
- sysctl | ||
- -w | ||
- kernel.keys.maxkeys=20000 | ||
- kernel.keys.maxbytes=400000 | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 1Mi | ||
limits: | ||
cpu: 100m | ||
memory: 5Mi | ||
securityContext: | ||
# We need to run as root in a privileged container to modify | ||
# /proc/sys on the host (for sysctl) | ||
runAsUser: 0 | ||
privileged: true | ||
readOnlyRootFilesystem: true | ||
capabilities: | ||
drop: | ||
- ALL | ||
containers: | ||
- name: pause | ||
image: k8s.gcr.io/pause:3.5 | ||
command: | ||
- /pause | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 1Mi | ||
limits: | ||
cpu: 100m | ||
memory: 5Mi | ||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 65535 | ||
allowPrivilegeEscalation: false | ||
privileged: false | ||
readOnlyRootFilesystem: true | ||
capabilities: | ||
drop: | ||
- ALL | ||
terminationGracePeriodSeconds: 5 | ||
``` | ||
|
||
At a later point, you can delete the DaemonSet by running: | ||
|
||
```console | ||
$ kubectl delete --namespace=kube-system daemonset increase-limits | ||
daemonset.apps "increase-limits" deleted | ||
``` | ||
|
||
However, note that the setting will persist until the node restarts or another | ||
program sets the `kernel.keys.maxkeys` and `kernel.keys.maxkeys` settings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest we expand on this and add a daemonset example, we can reuse some of the content from the inotify watch limit doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jawnsy Do you mind reviewing the content I added re: DaemonSets? I'm not super familiar w/ these so am open to all suggestions