I have a bash script that I want to execute from within MATLAB. I use system() to execute it. However when it executes I get
docker: command not found
I am using docker commands from within the script and I have it properly installed in my computer. If I run the script from the terminal using the exact same command I have running from the system() call in MATLAB it works fine. To the extent that if I just remove the bash script execution call from my MATLAB function (the last line) and run the function and then run the script from the terminal it all works.
For example here is a MATLAB function:
function foo(container_id)
% Copies this file to the root of a docker container given by container_id
system(['./copy_foo.sh ' container_id])
end
And here is the bash script
#!/bin/bash
docker cp foo.m $1:/root
Running it from the terminal
./copy_foo.sh CONTAINER_ID
produces the desired result. Running the Matlab function from the command window
foo('CONTAINER_ID')
yields:
docker: command not found
systemcommand - Paolosystemmight use a differentPATH, see "UNIX tips and limitations" here - Benjamin W.dockerexecutable does not seem to be within your $PATH in the subshell that Matlab opens when you use theirsystem()call. What if you explicitly set the same PATH (that you have in your bash terminal) in your bash script? - lab9