Jan
Jan

Reputation: 1130

Gitlab doesn't run script when using my own Docker Image

I've created a super simple Docker image. When I use that image in Gitlab through a .gitlab-ci.yml file, the Gitlab-"script:" part gets never executed. It's always:

Executing "step_script" stage of the job script
Cleaning up project directory and file based variables

If I add a "report:" entry to my yml, I get for the last line an "Uploading artifacts for failed job".

It seems as if the bash inside the Docker image is somehow broken, but I don't see how, since I can use docker run MyImage <command> to succesfully run bash commands.

Also, Gitlab lets the pipeline run indefinetly after the last line, never ending it. I never experienced this with other Docker images.

Do I have to modify some rights, or something? I can run e.g. the official gradle Docker image, but not mine, anyone has an idea why?

My simple .gitlab-ci.yml:

image:
  name: <... My Image ...>

stages:
  - build

build-stage:
  stage: build

  script:    
    - echo "Testing echo"

My simple Dockerfile:

FROM ubuntu:20.10

CMD ["bash"]

Upvotes: 0

Views: 715

Answers (1)

Jan
Jan

Reputation: 1130

The problem was that my host system is Apple Silicon, while the target Gitlab server runs on AMD64. So I created linux/arm64, not linux/amd64 images. Setting the system explicitly, like

docker build --platform linux/amd64 -t MyImageName .

fixed it. A big problem is Gitlab, which just fails, without any notification on the log output like "wrong architecture".

Upvotes: 1

Related Questions