Gitlab CI seems not to be deploying commands within container

I am running a gitlab ci script. It is to summon php:5.6 and run the commands within the php:5.6 container, but I have a feeling that gitlab is bashing this out in the Ubuntu shell of the gitlab-runner instead of the container.

This is the Gitlab CI:

  stage: deploy
  image: php:5.6
  allow_failure: true
  - arc
    PWS_IP: 'X.X.X.X'
  - sudo apt-get update && sudo apt-get install -y libxml2-dev git
  - docker-php-ext-install soap
  - git config --global http.sslVerify false
  - git diff --name-only origin/DEV | xargs php ./scripts/pws_loadgroovy.php
   - DEV
   - $CI_PROJECT_ID == "71"

however the CI is failing at the docker-php-ext-install soap command with a command not found error. I know that the command ‘must’ be executed from within the php container image or it will not work.

When I perform sudo docker run --rm -it php:5.6 bash and issue the same command from within the docker bash, the command is successful which leads me to believe the issue is, the CI pipeline is not properly engaging the command into the container. Is there anything wrong with my CI that may prohibit docker from executing the command properly?

Just wanted to see if anyone might have any suggestions.

Any chance the docker-php-ext-install is NOT accessible via PATH? That it works when you run the container & use bash as the entry point because it’s in the user’s CWD? I ask because the CWD of the job is set to be the top-level folder of the fetched repository. So that’s a different context, making the docker run not exactly equivalent to what the pipeline is doing. One caveat: my pipeline processing understanding is based on our kubernetes runner ecosystem. I don’t see in your post which type of executor your runner is utilizing.

what happens if you use the absolute path of the docker-php-ext-install command? As I just pulled the 5.6 image, ran it as you had, that binary is in /usr/local/bin which is on the PATH for the container. Likely that it’s also on PATH when run as the pipeline container but I can’t guarantee that. hence the curiosity regarding using the /usr/local/bin/docker-php-ext-install path.