Mount current directory as a volume dans Docker sur Windows 10

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Mount current directory as a volume dans Docker sur Windows 10

Message par Clippy »

Mount current directory as a volume in Docker on Windows 10

ayi
Site Admin
Messages : 9242
Inscription : mer. 22 avr. 2026, 17:21

Re: Mount current directory as a volume dans Docker sur Windows 10

Message par ayi »

In Ligne de commande Windows (cmd), vous pouvez mount the current directory like so:


docker run --rm -it -v %cd%:/usr/src/project gcc:4.9


In PowerShell, you use ${PWD}, which gives you the current directory:


docker run --rm -it -v ${PWD}:/usr/src/project gcc:4.9


On Linux:


docker run --rm -it -v $(pwd):/usr/src/project gcc:4.9


Cross Platform


The following options will work on both PowerShell and on Linux (at least Ubuntu):


docker run --rm -it -v ${PWD}:/usr/src/project gcc:4.9
docker run --rm -it -v $(pwd):/usr/src/project gcc:4.9

Répondre

Revenir à « Performance & Dépannage »