Python command not found on custom docker image

Hi, i have a custom primary docker image (debian clone) wich has, next to the actual build tools, also python3 installed. I need python to run a python script after the actual build process to transform ctest report into something cricleci can understand.
But unfortunately after calling python i get a command not found error. I guess it is somehow a problem with the Dockerfile.

Your Dockerfile is installing Python v3 not v2. In many distros right now, Python v3 has to be called using python3 not python.

Two good solutions would be:

  1. Use python3 instead of python.
  2. Symlink python to python3 which will allow you to continue to use python in your scripts/CircleCI config though it wil use Python v3.

Unfortunately thats also not working. I can run python3 via build of the image
Step 8/9 : RUN python3 --version
—> Running in 2bad5f1045d2
Python 3.7.3
With config.yml I get again the error
- run: python3 --version
====>> python3 --version
#!/bin/bash -eo pipefail
python3 --version
/bin/bash: python3: command not found
Exited with code exit status 127

Correct. In your config, I see you are using the image “dockerben/cpptemplate:latest”. That is not currently the same image as the Dockerfile you link in your first post.

If I use dockerben/cpptemplate:latest, I get the error you’re getting. If I build the image myself from your Dockerfile and then run it, it works.

ok that’s weird, because i build it also from the dockerfile and pushing it up to dockerhub to dockerben/cpptemplate:latest. Is it correct how i’m doing this? I thought what is now on dockerhub is exactly the same as defined in Dockerfile.
sudo docker build -t cpptemplate .
sudo docker push dockerben/cpptemplate:latest

How are you running the config.yml with a local image?
I used sudo circleci local execute

Ok i found it, somehow the tag between local docker and dockerhub dockerben/cpptemplate:latest was broken. I had to delete it manualy and then reassign it. Thnx for the help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.