This is a method to mount the location of the batch file as volume when starting the docker container. This is useful when you want to use bash wherever you want.
Windows 10 (1909) Docker version 19.03.13
Create the following batch file and place it wherever you like. Double-click to start. If you want to pass arguments to the container, D & D to a batch file.
launch.bat
@setlocal
@rem container image
@set IMAGE=buildpack-deps:buster
@rem working directry in container
@set WORK=/workspace
@rem ###########################
@cd /d %~dp0
docker run -it --rm -v "%CD%:%WORK%" -w "%WORK%" %IMAGE% %*
@if errorlevel 1 (
pause
exit /b %errorlevel%
)
@exit /b 0
I have set the docker image name to start in IMAGE
. Please rewrite it with your favorite image.
Specify the mount destination in WORK
. Please rewrite to an appropriate mount point without a container.