[Bug]: --mount and -v accept a relative container path and mount it at /<path>
I maintainer di solito rispondono entro 1 giorno
@devops-thiago ci sta già lavorando.
Dal 1/10/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 86/100
Direzione di ricerca
Inizia in Sources/Services/ContainerAPIService/Client/Parser.swift, in particolare in Parser.validateMount e Parser.tmpfsMounts, e confronta il modo in cui ciascuna forma di mount valida la propria destinazione. Il lavoro è completato quando i percorsi del container relativi, vuoti e basati su punti vengono rifiutati in modo coerente per --mount, -v e --tmpfs con l'errore esistente per i percorsi assoluti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I have done the following
- I have searched the existing issues
- If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Give any mount form a relative path on the container side:
container run --rm --mount type=bind,source=/tmp,target=data alpine:latest sh -c 'ls -ld /data; mount | grep " /data "'
The container starts and the host folder is mounted at /data (image pull progress omitted):
drwxrwxrwt 1241 root root 39712 Oct 1 17:26 /data
virtiofs on /data type virtiofs (rw,relatime)
The other forms are accepted the same way and also end up at /data:
container volume create evvol
container run --rm --mount type=volume,source=evvol,target=data alpine:latest ... # ext4 on /data
container run --rm -v evvol:data alpine:latest ... # ext4 on /data
container run --rm -v data alpine:latest ... # anonymous volume, ext4 on /data
container run --rm --mount type=tmpfs,target=data alpine:latest ... # tmpfs on /data
Paths with . and .. are accepted too. target=../x is mounted at /x, -v data:a/../../y at /y and target=./z at /z.
--tmpfs rejects the same path:
$ container run --rm --tmpfs data alpine:latest true
Error: data is not an absolute path
container create stores the value as typed. container inspect shows "destination" : "data" for a container whose running mount is /data.
A debug build of main at 0a48a1b accepts the same forms and rejects --tmpfs.
Problem description
Parser.validateMount is where parsed --mount and -v values are checked. For a filesystem or volume mount it only checks that the container path is not empty:
if fs.destination.isEmpty {
throw ContainerizationError(.invalidArgument, message: "mount destination cannot be empty")
}
--tmpfs is stricter. Parser.tmpfsMounts rejects a relative path, added in #2103 for #2094, which says the destination "must be a non-empty absolute path". The same input is therefore an error for one flag and quietly reinterpreted by the others. A typo such as -v data:app/data mounts at /app/data without a word.
The container path is a location inside the container, and the OCI runtime spec requires it to be an absolute path (mounts[].destination in config.md). Every mount form should fail at parse time with the message --tmpfs already gives.
Environment
- OS: macOS 26.6.2 (25G83)
- Xcode: 26.6 (17F113)
- Container: 1.5.0 (Homebrew), and main at 0a48a1b
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lingua principale
- Swift
- Stelle
- 51k
- Fork
- 1.8k
- Merge medio
- 2g 10h
- PR unite (30g)
- 39
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apple/container
-
[Bug]: Intermittent failure in PathUtilsTests.testNewDirectoryIsExcludedAndExistingChoiceIsKeptAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
apple/container#2474 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Request]: container ls --filter label=key=valueForse già presa @kavix l’ha presa 11 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apple/container#2403 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Request]: Improve robustness and path resolution in ensure-hawkeye.shForse già presa @denizguney l’ha presa 34 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: kernel download hangs forever when the server stops sendingForse già presa @devops-thiago l’ha presa 37 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
apple/container#2327 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: container export -o deletes an existing directoryForse già presa @devops-thiago l’ha presa 37 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apple/container#2325 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apple/container
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
rock3r/remozio#600 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Bug JSON
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
nightscout/Trio#1748 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
carp-dk/flutter-plugins#1312 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
newrelic/newrelic-flutter-agent#256 ·
I maintainer di solito rispondono entro 1 giorno