Skip to content
  • Thanks for this setup! I'm successfully using it and have Colima auto-starting when I log into my macOS user account using the Automator.app approach described here: https://superuser.com/questions/229773/run-command-on-startup-login-mac-os-x

  • Troubleshooting K3d

    Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

    It looks like K3d ignores the currently set docker context and uses the "default" context instead. I worked around this by setting DOCKER_HOST to the colima docker socket:

    ~ docker context ls
    NAME            DESCRIPTION                               DOCKER ENDPOINT                                 KUBERNETES ENDPOINT             ORCHESTRATOR
    colima *        colima                                    unix:///Users/alexand/.colima/docker.sock
    default         Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                     https://34.70.25.18 (default)   swarm
    desktop-linux                                             unix:///Users/alexand/.docker/run/docker.sock
    
    ~ k3d cluster list
    ERRO[0000] Failed to get clusters
    FATA[0000] Failed to list containers: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
    
    ~ export DOCKER_HOST=unix:///Users/alexand/.colima/docker.sock
    ~ k3d cluster list
    NAME   SERVERS   AGENTS   LOADBALANCER

    Maybe we should propose that we do this on the snippet? (export DOCKER_HOST=unix:///Users/{YOUR_OS_USER}/.colima/docker.sock)

  • Troubleshooting GitLab Runner + Docker setup using Colima

    I had an issue with the GitLab Runner + Docker using Colima.

    I ran this command to register a runner based on the how-to instructions:

    # assuming `/tmp/gitlab-runner` directory already exists
    docker run --rm -it \
    -v "$(pwd)/gdk.test.crt:/etc/gitlab-runner/certs/gdk.test.crt" \
    -v "/tmp/gitlab-runner:/etc/gitlab-runner" \
    gitlab/gitlab-runner register --run-untagged

    It seemed like Colima wasn't able to write to the /tmp/gitlab-runner directory, which is mapped to the mounted /etc/gitlab-runner volume. It turns out that you had to update the lima configuration (found in $HOME/.lima/colima/lima.yaml) and set a directory on the host (your local machine) to be writable from the container, e.g.:

    mounts:
        - location: "~"
          writable: true
        - location: /tmp/colima
          writable: true

    I think these are the 2 possible solutions

    • set the /tmp/gitlab-runner directory to be writable (I hadn't tried this)

    • change the GitLab Runner registration command so that the /etc/gitlab-runner volume is mapped to a directory under the already writable /tmp/colima (this is what I went with):

      mkdir /tmp/colima/gitlab-runner
      
      # note the use of "/tmp/colima/gitlab-runner" instead of "/tmp/gitlab-runner"
      docker run --rm -it \
      -v "$(pwd)/gdk.test.crt:/etc/gitlab-runner/certs/gdk.test.crt" \
      -v "/tmp/colima/gitlab-runner:/etc/gitlab-runner" \
      gitlab/gitlab-runner register --run-untagged
    Edited by Pam Artiaga
  • @Alexand this probably has been fixed in the meantime. I didn't have to set the DOCKER_HOST explicitly to make colima work with k3d 🎉

  • @timofurrer, that's great news as far as setting up k3d goes.

    But just to check -- Have you registered your runner on your host or as a container? I still had to set up DOCKER_HOST 2 weeks ago because my host runner did not find the docker socket. With a dockerized runner I don't think this will be a problem, though. So it might still be needed for host runners with docker executors.

    Edited by João Alexandre Cunha
  • @Alexand I'm using the dockerized runner ...

  • Setting up Colima to run a non-GitLab service that needs to be accessible from the browser. I thought port forwarding to the guest network would work without any customization, but in the end I had to use colima start --arch x86_64 --network-address to be able to access services running in containers via the browser. Just a head's up for anyone else using this to get started 😸

  • For those who aren't aware, there's documentation specific to using colima with the GitLab runners here which might be useful, especially if you're running into the error Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment