Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Docker on Mac runners #1456

Closed
armenzg opened this issue Nov 2, 2021 · 11 comments
Closed

Install Docker on Mac runners #1456

armenzg opened this issue Nov 2, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@armenzg
Copy link

armenzg commented Nov 2, 2021

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.

@armenzg
Copy link
Author

armenzg commented Nov 19, 2021

Closed as per actions/runner-images#2150

@Jasperav
Copy link

@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?

@joffrey-bion
Copy link

joffrey-bion commented Aug 13, 2023

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.

@rfay
Copy link

rfay commented Aug 13, 2023

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.

@joffrey-bion
Copy link

joffrey-bion commented Aug 13, 2023

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).

@Jasperav
Copy link

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

@joffrey-bion
Copy link

@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!

@rfay
Copy link

rfay commented Nov 20, 2023

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.

@Jasperav
Copy link

@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.

@rfay
Copy link

rfay commented Nov 20, 2023

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

@timmyjose
Copy link

timmyjose commented Mar 15, 2024

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?

HoloRin added a commit to rabbitmq/rabbitmq-server that referenced this issue Apr 4, 2024
HoloRin added a commit to rabbitmq/rabbitmq-server that referenced this issue Apr 4, 2024
HoloRin added a commit to rabbitmq/rabbitmq-server that referenced this issue Apr 4, 2024
HoloRin added a commit to rabbitmq/rabbitmq-server that referenced this issue Apr 4, 2024
HoloRin added a commit to rabbitmq/rabbitmq-server that referenced this issue Apr 5, 2024
HoloRin added a commit to rabbitmq/rabbitmq-server that referenced this issue Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants