Source: https://gitlab.com/sdwolfz/docker-here
Install Link to heading
git clone https://gitlab.com/sdwolfz/docker-here.git
cd docker-here
sudo make install
Usage Link to heading
Instead of doing this:
docker run --rm -it -u "$(id -u)":"$(id -g)" -v "$PWD":/here -w /here alpine ls
Now you can do this:
docker-here alpine ls
You can change both the working directory and the mount path with -w
:
docker-here -w /work alpine pwd
Run as root with the -r
flag:
docker-here -r alpine whoami
Or do a dry-run using -V
:
docker-here -V alpine ash
# docker run --rm -it -u 1000:1000 -v /home/user:/here -w /here alpine ash
And more importantly, it can be used with envchain
, whereas bash aliases could
not.