Improve handling when run using root user (#1572)

Allow for the image to be run with the root user if desired, however
change to requiring setting of a variable to allow it to continue as it
may change ownership of files unexpectedly.

Additionally ensure that the workdir passed to docker matches the target
mount path used, in case the realpath to ${PWD} resolves to be different
to it's value resulting in the starting workdir being somewhere
different to the current path on the host.

Fixes: #1442
This commit is contained in:
Darragh Bailey
2022-09-03 12:37:25 +01:00
committed by GitHub
parent 42411eb005
commit c28aca9d21
2 changed files with 33 additions and 11 deletions

View File

@@ -86,7 +86,7 @@ docker run -i --rm \
-v /var/run/libvirt/:/var/run/libvirt/ \
-v ~/.vagrant.d:/.vagrant.d \
-v $(realpath "${PWD}"):${PWD} \
-w $(realpath "${PWD}") \
-w "${PWD}" \
--network host \
vagrantlibvirt/vagrant-libvirt:latest \
vagrant status
@@ -100,7 +100,7 @@ vagrant(){
-v /var/run/libvirt/:/var/run/libvirt/ \
-v ~/.vagrant.d:/.vagrant.d \
-v $(realpath "${PWD}"):${PWD} \
-w $(realpath "${PWD}") \
-w "${PWD}" \
--network host \
vagrantlibvirt/vagrant-libvirt:latest \
vagrant $@
@@ -126,7 +126,7 @@ vagrant(){
-v /var/run/libvirt/:/var/run/libvirt/ \
-v ~/.vagrant.d:/.vagrant.d \
-v $(realpath "${PWD}"):${PWD} \
-w $(realpath "${PWD}") \
-w "${PWD}" \
--network host \
--entrypoint /bin/bash \
--security-opt label=disable \