devcontainers / devcontainers/features

`docker-in-docker` feature wastes RAM by mounting `/tmp` to tmpfs

Open
#471 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
1.5k
Forks
621
Avg merge
2d 11h
Merged PRs (30d)
4

Description

It seems like adding the feature like so:

```jsonc
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:0-3.11",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
}
}
```

Mounts `/tmp` to tmpfs on default:
https://github.com/devcontainers/features/blob/3cc059ea8abf3a909468fafabca481f82b6f8924/src/docker-in-docker/install.sh#L353-L356

Which results in some unexpected behaviours:
1. The `/tmp` directory is now limited by the amount of RAM that is available, which results in `Out of space` Exception for programs using a lot of `tmp` space (or users with limited amount of RAM).
2. The RAM of the host system is wasted for `tmp` files.

#### Workaround:

Mounting your own volume to `/tmp`:
`"runArgs": ["--mount", "type=volume,target=/tmp/"],`

#### Related
Here is my way of suffering: https://stackoverflow.com/questions/75630189/why-and-where-is-the-tmp-directory-size-limited-in-vscode-devcontainers ;)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.