You are not using the right directory and also not specifying to run python from the current directory so it will not find it - this is a PATH issue rather than anything else. You need to do the following to get this to work:
root@aebe3751b290:~# /opt/couchbase/lib/python/runtime/bin/python3.7 --version
root@aebe3751b290:/opt/couchbase/lib/python/runtime/bin# cd /opt/couchbase/lib/python/runtime/bin
root@aebe3751b290:/opt/couchbase/lib/python/runtime/bin# ./python3.7 --version
root@aebe3751b290:/opt/couchbase/lib/python/runtime/bin# python3.7 --version
bash: python3.7: command not found
Notice the use of
./ to indicate to run the command in the current directory and not search the PATH. You should be able to use the
pip commands at the location specified to carry out what you need.
As @davidkelly indicates above you can get the latest python by installing it, however if you want a specific version then you have to add another repository which requires
apt update to be run.
It is best practice as well to always run
apt update as part of the same
RUN statement: Best practices for writing Dockerfiles | Docker Documentation
You can combine your commands into a single
RUN command ideally with the additional commands to remove the cache afterwards.