devcontainers / devcontainers/features

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

Aperta
#471 5 commenti 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Shell
Stelle
1.5k
Fork
621
Merge medio
6g 53m
PR unite (30g)
9

Descrizione

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 ;)

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da src/docker-in-docker/install.sh intorno alle righe 353-356, dove la feature monta /tmp, e analizza il comportamento di mount predefinito. Confrontalo con il workaround del volume segnalato e verifica che la feature non limiti più inaspettatamente /tmp alla RAM dell’host.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
docker, shell
Ambito
devops
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.