skip to Main Content

I am trying to build CI pipeline which does build for particular image. In the CI file however, I could not find a way to specify image platform.

stages:
  - build
  - deploy

build_j:
  image: customServer/debian/jessy

I checked Docker Images doc and this but could not find any example. Alternative way perhaps is to pull image explicitly and run commands using script.

docker pull debian:jessy -platform i386

2

Answers


  1. Since multi architecture/platform tags of a Docker image have different digests, You can pull a Docker image using its digest (instead of using tags) to pull the desired architecture/platform.

    Here is an example of multi architecture/platform tag of a Docker image (Ubuntu) in Docker Hub:
    enter image description here
    As you can see, 20.04 is a multi architecture tag and there are different digests for each of architectures in the tag.
    If you run command docker pull ubuntu:20.04
    it will pull all architectures.
    But command
    docker pull ubuntu@sha256:55e5613c8c7bcd8044aaf09d64d20518964a0d7a6e41af129f95b731301c2659
    will pull just linux/arm/v7.

    As I tried, it is possible to use digest in .gitlab-ci.yml:

    job_1:
      image: ubuntu@sha256:55e5613c8c7bcd8044aaf09d64d20518964a0d7a6e41af129f95b731301c2659
      script:
        - ...
    
    job_2:
      image: alpine@sha256:71465c7d45a086a2181ce33bb47f7eaef5c233eace65704da0c5e5454a79cee5
      script:
        - ...
    
    
    Login or Signup to reply.
  2. Speaking of image digest, GitLab 13.5 (October 2020) proposes:

    Create release with image digest on new tag

    Docker supports immutable image identifiers and we have adopted this best practice to update our cloud-deploy images.

    When a new image is tagged, we also programmatically retrieve the image digest upon its build, and create a release note to effectively communicate this digest to users.
    This guarantees that every instance of the service runs exactly the same code.
    You can roll back to an earlier version of the image, even if that version wasn’t tagged (or is no longer tagged). This can even prevent race conditions if a new image is pushed while a deploy is in progress.

    https://about.gitlab.com/images/13_5/digest.png -- Create release with image digest on new tag

    See Documentation and Issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search