I want to use docker-compose yml file to update the container's PATH.
environment:
- PATH="$PATH":/my/new/path
But when I start the container, it says
oci runtime error: exec failed: container_linux.go:265: starting container process caused "exec: \"bash\": executable file not found in $PATH"
Is it possible to update the container's PATH from docker-compose yml file?
Thanks.
What you are doing is updating the PATH, however the error is resulting from the fact that $PATH is being expanded to the env variable's value that is on the host.
What you can do is figure the PATH value that is inside the container by default and appending to that value:
Start the image without the variable:
docker-compose up
docker exec -it <container-name> bash
echo $PATH and copy the valueenvironment:
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/my/new/path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With