docker-exec failed: “cd”: executable file not found in $PATH

cd is a built-in shell command, you can’t set it as the command to run. You have to use:

docker exec -i compassionate_mclean bash -c "cd /root/python && python myscript.py"

If you want to see the output make sure to add the -i flag as shown above. In this case however, you can simply run python as your entrypoint:

docker exec -i compassionate_mclean python /root/python/myscript.py

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)