Skip to content

Gitlab CI Fails #1530

Open
Open

Description

@t-moe

Is it possible that the linked FAQ is out of date?

i always get

Error:
0: no container engine found

here is my example repo https://gitlab.com/t-moe/cross-gitlab-ci-test/
with an example run: https://gitlab.com/t-moe/cross-gitlab-ci-test/-/jobs/7403853167

Originally posted by @t-moe in #1507 (comment)

Activity

  1. Emilgardis commented on Jul 23, 2024

    @Emilgardis
    Member

    Do you mean https://github.com/cross-rs/cross/wiki/FAQ#gitlab-ci ? It might be :/

    This might be interesting #1351 (comment) however

  2. t-moe commented on Jul 23, 2024

    @t-moe
    Author

    Yes, I mean that one.

    I read that comment, but this also does not resolve the issue:

    Using docker image sha256:074f1687a41ccf251dae357352554e41bd8168aecd480acab710389d6f78837d for docker:18.09 with digest docker@sha256:58469a43b529313091f1df424037895a9961b27149aafec812ce8fd8d7ac0c9d ...
    $ printenv | grep -v "^HOSTNAME=" > env.list
    $ docker run --rm --env-file env.list -v /var/run/docker.sock:/var/run/docker.sock rust:latest bash -c "git clone $CI_REPOSITORY_URL /data && cd /data/ && cross -v build"
    docker: error during connect: Post http://docker:2375/v1.39/containers/create: dial tcp: lookup docker on 127.0.0.11:53: no such host.

  3. Emilgardis commented on Jul 23, 2024

    @Emilgardis
    Member

    try using cross from the main branch

  4. t-moe commented on Aug 5, 2024

    @t-moe
    Author

    Same or similar error. I've tried various workarounds, listed in the issue tracker. None of them seemd to work. (Sorry for not having them listed out here, for further reference).

    In the end I had to pivot to manually invoking cross on my developer machine, because I could not spend more time on this issue :(.

  5. Emilgardis commented on Aug 6, 2024

    @Emilgardis
    Member

    Sorry you're having issues! I've not experimented with gitlab too much so I'm not super familiar, hopefully I can get some time to look into the woes people are having with it + cross

  6. albohlabs commented on Feb 11, 2025

    @albohlabs

    The problem is that which-rs is used to locate the path of the docker binary.

    cross/src/docker/engine.rs

    Lines 328 to 334 in 107433f

    pub fn get_container_engine() -> Result<PathBuf, which::Error> {
    if let Ok(ce) = env::var("CROSS_CONTAINER_ENGINE") {
    which::which(ce)
    } else {
    which::which(DOCKER).or_else(|_| which::which(PODMAN))
    }
    }

    Cause the docker is attached via a tcp://docker:2375 it could not be detected.

    https://github.com/harryfei/which-rs/blob/bd868818bdb55923acfd2a63468335f6600a6cf9/src/lib.rs#L90-L96

    I may have some time to look into this.

  7. crespum commented on Sep 3, 2025

    @crespum

    I'm experiencing the same issue. Has anyone managed to fix it?

  8. SolidTux commented on Dec 16, 2025

    @SolidTux

    Not OP, but the following works for me:

    stages:
      - build
    
    build:aarch64:
      variables:
        DOCKER_HOST: tcp://docker:2375/
        DOCKER_DRIVER: overlay2
        CROSS_REMOTE: 1
      image: rust:slim
      services:
        - docker:dind
      stage: build
      before_script:
        - apt update
        - apt install -y docker-cli curl
        - curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
        - cargo binstall cross
      script:
        - cross build --release --target aarch64-unknown-linux-musl
        - cp "target/aarch64-unknown-linux-musl/release/$CI_PROJECT_NAME" "${CI_PROJECT_NAME}-aarch64"
      artifacts:
        paths:
          - ${CI_PROJECT_NAME}-aarch64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions