Python --version send back an error


I’m new to gitlab and I have a small issue.

I have this yml :

image: docker
  - docker:dind    
    - apk add --no-cache docker-compose
    - docker-compose up -d
    - apk add python3
    - apk add py3-pip
    - pip --version
    - python --version

It run well but the last line send this message :
python --version
/bin/sh: eval: line 123: python: not found

Even if the pip --version line works well and told me :
pip 20.3.4

I can’t figure out why because both packages installation went well
Thank you

I would try python3 --version

I have the same result

  1. Could you post the whole log of the job?
  2. AFAIU, you are installing python in the job’s container, not in the container created by docker-compose. Is that what you want?

Without the docker-compose command, this does work on the command line (with python3):

$ docker run -ti --rm docker:dind /bin/sh

Unable to find image 'docker:dind' locally
dind: Pulling from library/docker
ba3557a56b15: Already exists 
94caa5d1da70: Pull complete 
a10a29983da5: Pull complete 
b071e807615f: Pull complete 
e312d1fdaab9: Pull complete 
f22fb1b38bf3: Pull complete 
29c60ac17505: Pull complete 
91afbfdd7b77: Pull complete 
babfe5fbbe65: Pull complete 
96c24736699a: Pull complete 
24c37595645a: Pull complete 
Digest: sha256:5f7534177e58946bfffd730e57c4999fc50b231d2b3ee4dc92dcb84f5f43582a
Status: Downloaded newer image for docker:dind

/ # apk add python3
(1/7) Installing libbz2 (1.0.8-r1)
(2/7) Installing expat (2.2.10-r1)
(3/7) Installing libffi (3.3-r2)
(4/7) Installing gdbm (1.19-r0)
(5/7) Installing readline (8.1.0-r0)
(6/7) Installing sqlite-libs (3.34.1-r0)
(7/7) Installing python3 (3.8.7-r1)
Executing busybox-1.32.1-r3.trigger
OK: 75 MiB in 57 packages

/ # python
/bin/sh: python: not found

/ # python3 --version
Python 3.8.7

/ #