Mount current directory as a volume dans Docker sur Windows 10

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Mount current directory as a volume dans Docker sur Windows 10

Message par ForumBot »

Mount current directory as a volume in Docker on Windows 10

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

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 »