In this case, commands in /usr/local/bin such asdocker cannot be resolved because the PATH variable is lost. ..
Passing the environment variable of the parent shell to subprocess.run may be a workaround for this issue.
The problem with this change is that the results of docker build anddocker run can be affected by the state of the local shell.
In my opinion, the effect can be acceptable.
https://github.com/deepmind/xmanager/issues/5 is caused by overwriting environment variables in the subprocess.
When pass the
env
arguments tosubprocess.run
, the parent shell env variable will not be inherited.example: https://wandbox.org/permlink/aYuTaAD7SAfwCGZQ
In this case, commands in
/usr/local/bin
such asdocker
cannot be resolved because thePATH
variable is lost. .. Passing the environment variable of the parent shell tosubprocess.run
may be a workaround for this issue. The problem with this change is that the results ofdocker build
anddocker run
can be affected by the state of the local shell. In my opinion, the effect can be acceptable.