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

Build docker image fails on mac #71

Closed
geonnave opened this issue Apr 25, 2023 · 1 comment
Closed

Build docker image fails on mac #71

geonnave opened this issue Apr 25, 2023 · 1 comment
Labels
bug Something isn't working install

Comments

@geonnave
Copy link

geonnave commented Apr 25, 2023

I tried to build the docker image on a mac m1 and got the following:

$ docker build -f .docker/Dockerfile . -t hacspec-v2
 => [2/6] COPY . /circus-sources
 => [3/6] RUN cd /circus-sources && git init && git add .
 => ERROR [4/6] RUN nix-env -iA cachix -f https://cachix.org/api/v1/install
------
 > [4/6] RUN nix-env -iA cachix -f https://cachix.org/api/v1/install:
#8 1.244 installing 'cachix-1.3.3'
#8 1.479 copying path '/nix/store/6yjms3wa9f2hrpmbzk7ivm1s9jz2m0sw-busybox-static-x86_64-unknown-linux-musl-1.36.0' from 'https://cache.nixos.org'...

(... truncated ...)

#8 12.65 copying path '/nix/store/aly587hv5cyjsbl0fy4ps3lyy7r8cr8n-cachix-1.3.3' from 'https://cache.nixos.org'...
#8 14.67 error: unable to load seccomp BPF program: Invalid argument
#8 14.67 (use '--show-trace' to show detailed location information)
------
executor failed running [/bin/sh -c nix-env -iA cachix -f https://cachix.org/api/v1/install]: exit code: 1

Possible solution

In this issue I learned that it could be fixed by adding filter-syscalls = false to nix.conf (which indeed makes the build work).

A possible solution is to modify the Dockerfile as follows (although it does not seem super safe to disable filter-syscalls).

diff --git a/.docker/Dockerfile b/.docker/Dockerfile
index 0a46de5..e960589 100644
--- a/.docker/Dockerfile
+++ b/.docker/Dockerfile
@@ -3,6 +3,8 @@

 FROM nixpkgs/nix-flakes

+RUN [ "$(uname)" = Darwin ] && echo "filter-syscalls = false" >> /etc/nix/nix.conf
+
 # Prepare the sources
 COPY . /circus-sources
 RUN cd /circus-sources && git init && git add .

Versions

  • Mac M1, MacOS Ventura 13.2.1 (22D68)
  • Docker version 20.10.24, build 297e128
@W95Psp
Copy link
Collaborator

W95Psp commented Jun 8, 2023

Hi @geonnave, sorry I forgot about that issue!
I think the fix with filter-syscalls is completely fine; we're in a docker image, so if we mess with the Nix sandbox that is not too important.
Made PR #133!

bors bot added a commit that referenced this issue Jun 12, 2023
133: Docker filter syscalls (fixes #71) r=franziskuskiefer a=W95Psp

Fixes docker build for M1, as suggested by `@geonnave` in issue #71.
Thanks `@geonnave` :)

Co-authored-by: Lucas Franceschino <[email protected]>
Co-authored-by: Franziskus Kiefer <[email protected]>
bors bot added a commit that referenced this issue Jun 12, 2023
133: Docker filter syscalls (fixes #71) r=W95Psp a=W95Psp

Fixes docker build for M1, as suggested by `@geonnave` in issue #71.
Thanks `@geonnave` :)

Co-authored-by: Lucas Franceschino <[email protected]>
bors bot added a commit that referenced this issue Jun 12, 2023
133: Docker filter syscalls (fixes #71) r=W95Psp a=W95Psp

Fixes docker build for M1, as suggested by `@geonnave` in issue #71.
Thanks `@geonnave` :)

Co-authored-by: Lucas Franceschino <[email protected]>
bors bot added a commit that referenced this issue Jun 12, 2023
133: Docker filter syscalls (fixes #71) r=W95Psp a=W95Psp

Fixes docker build for M1, as suggested by `@geonnave` in issue #71.
Thanks `@geonnave` :)

Co-authored-by: Lucas Franceschino <[email protected]>
@bors bors bot closed this as completed in 7254883 Jun 12, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in hax Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working install
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants