Skip to content

Install Docker on Mac runners #1456

Closed
Closed

Description

@armenzg

I have to add this code for Mac runners when I need Docker to be available:

HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask docker
sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
open -a /Applications/Docker.app --args --unattended --accept-license
echo "We are waiting for Docker to be up and running. It can take over 2 minutes..."
while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do sleep 1; done

It takes a lot of time. Would you be able to install it by default?
Thanks.

Activity

  1. added
    bug
    on Nov 2, 2021
  2. armenzg commented on Nov 19, 2021

    @armenzg
    Author
  3. Jasperav commented on Dec 16, 2021

    @Jasperav

    @armenzg I use your code to run Docker in Mac, it works most of the time. However, it sometimes fails with this error:

    Run brew install --cask docker
      brew install --cask docker
      sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
      open -a /Applications/Docker.app --args --unattended --accept-license
      echo "We are waiting for Docker to be up and running. It can take over 2 minutes..."
      while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do sleep 1; done
      shell: /bin/bash -e {0}
      env:
        CARGO_NET_GIT_FETCH_WITH_CLI: true
        SSH_AUTH_SOCK: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//ssh-uRt0rNE2QGjc/agent.1085
        SSH_AGENT_PID: 1086
    ==> Downloading https://desktop.docker.com/mac/main/amd64/72247/Docker.dmg
    Warning: macOS's Gatekeeper has been disabled for this Cask
    ==> Installing Cask docker
    Error: BOM for path '/private/tmp/d20211216-1296-14vsyc0/dmg.2FlyK0' is empty.
    ==> Purging files for version 4.3.1,72247 of Cask docker
    Error: Process completed with exit code 1.
    

    Any idea how I can prevent that error?

  4. joffrey-bion commented on Aug 13, 2023

    @joffrey-bion

    FTR, since the addition of colima to macOS runners, I now just need the following:

    - name: Setup docker (missing on MacOS)
      if: runner.os == 'macos'
      run: |
        brew install docker
        colima start

    Or when using docker-compose:

    - name: Setup docker and docker-compose (missing on MacOS)
      if: runner.os == 'macos'
      run: |
        brew install docker docker-compose
        
        # Link the Docker Compose v2 plugin so it's understood by the docker CLI
        mkdir -p ~/.docker/cli-plugins
        ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
        
        colima start

    You might need colima start --mount-type 9p to allow the containers launched via docker-compose to use chown (see abiosoft/colima#54 (comment))

    This usually takes between 1m30 and 2m, which is not perfect, but still much better than before.

  5. rfay commented on Aug 13, 2023

    @rfay

    I had no idea that colima was now in mac runners by default. Could you link to that addition @joffrey-bion ? That will help DDEV so much. It's been doing so much work to do its colima setup.

  6. joffrey-bion commented on Aug 13, 2023

    @joffrey-bion

    Here is the closed issue for the addition of colima: actions/runner-images#6216.

    You can also check the environment description for macos-latest runners (which is currently macOS 12).

  7. Jasperav commented on Nov 20, 2023

    @Jasperav

    @joffrey-bion Any idea why it is removed on macos 13? It doesn't work anymore

  8. joffrey-bion commented on Nov 20, 2023

    @joffrey-bion

    @Jasperav nope, I'm sorry I'm not part of GitHub, just a humble user 😅 But I would also like to know, because if that's a conscious decision then I'm going to have problems too!

  9. rfay commented on Nov 20, 2023

    @rfay

    Colima has worked all the way through macOS 13 and 14, but has had very significant problems getting v0.6.* stabilized in the last couple of weeks. But further comment belongs in the colima issue queue. Please read the release notes for v0.6.*, as a new profile has to be created, you lose existing volumes, containers, and images.

  10. Jasperav commented on Nov 20, 2023

    @Jasperav

    @rfay But the problem I am facing is that colima isn't available on macos-13 in the first place in Github Actions or is that related? I added a comment here: actions/runner-images#6216.

  11. rfay commented on Nov 20, 2023

    @rfay

    Here's how to use Colima with macos-13 in GitHub Actions until it's added there. I have no idea why it wasn't there in the first place (and have no idea why macos-latest is macos-12):

    https://github.com/ddev/ddev/blob/05ceed549d7807b1cebd63082910e54c37b1319e/.github/workflows/colima-tests.yml#L102-L106

  12. timmyjose commented on Mar 15, 2024

    @timmyjose

    Hello,

    I'm using a macos-13 runner, and I managed to start up my services using docker-compose using the tricks and tips mentioned in the comments in this thread.

    However, I'm unable to access the services themselves as part of the CI workflow (my Github Workflow launches services via docker-compose using colima, and then another (non-Dockerized) app tries to contact these services as part of e2e testing, in the same Workflow).

    So I have this snippet in my Workflow:

          - name: Run the required services
            run: |
              docker-compose up -d
              docker ps
    

    and the output for which, during the Workflow run, is:

    CONTAINER ID   IMAGE                         COMMAND                  CREATED         STATUS                  PORTS                                                 NAMES
    274e549a0abf   e2e-testing-demo-add_server   "/build/target/relea…"   5 seconds ago   Up Less than a second   0.0.0.0:9000->9000/tcp, :::9000->9000/tcp             e2e-testing-demo-add_server-1
    

    Now, I have an app which POSTs to the endpoints of these services. It wasn't working, so I decided to test via curl:

          - name: Test services using curl
            run: |
              curl -X POST -H 'Content-Type: application/json' -d '{"x": 200, "y": 100}' http://localhost:9000/exec 
    

    but these fail with the error: curl: (7) Failed to connect to 0.0.0.0 port 9000 after 1 ms: Couldn't connect to server. Error: Process completed with exit code 7.

    I also tried using 0.0.0.0 and 127.0.0.1 instead of localhost, but it's the same result.

    Is there some networking issue going on in here, maybe related to colima? Does anybody have a clue?

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions