devthefuture-org/dockerfile-x

ERROR: failed to solve on Ubuntu 20.04 arm64

Closed this issue · 7 comments

yuvron commented

I'm trying to build an image using the # syntax but for some reason, it crashes with only the message:
ERROR: failed to solve
referring to the first line in the Dockerfile:
# syntax = devthefuture/dockerfile-x

The same Dockerfile is built flawlessly on my Windows machine

running on arm64
OS: Ubuntu 20.04.6 LTS
Docker version: 24.0.5, build 24.0.5-0ubuntu1~20.04.1

When looking at the docker logs using journalctl -u docker.service -f I can see this line when trying to build the image:
exec /dockerfile-x-frontend: exec format error

I will be happy to provide any further necessary information

@devthejo

Could you provide your entire Dockerfile (so I can try to reproduce the error) ?
@yuvron

yuvron commented

I was doing the most basic thing

# syntax = devthefuture/dockerfile-x
FROM alpine
COPY . .

The build fails on the first line (#syntax), so the rest of the Dockerfile doesn't matter as I see it
For the record I also tried to use the special syntax that comes with dockerfile-x but the outcome was the same
@devthejo

I can't reproduce the bug myself, I tried to run this on LinuxMint 21 (based on Ubuntu 22.04).
No need to use custom syntax, it's a superset, so all standard syntax should work normally.
I'm on amd64, not arm64, maybe it's the problem, the go binary and node binary are both compiled for amd64, but I was believing that the dockerization make it transparent.
@yuvron Could you try to run npx dockerfile-x in the folder where is the Dockerfile to see if it's outputing correctly the final Dockerfile ?

@devthejo Thanks for writing a great plugin!

I'm also seeing issues on arm. Running on a Jetson AGX Xavier.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

$ uname -a
Linux user 5.10.120-tegra #1 SMP PREEMPT Tue Aug 1 12:32:50 PDT 2023 aarch64 aarch64 aarch64 GNU/Linux

$ ls
Dockerfile

$ cat Dockerfile
# syntax = devthefuture/dockerfile-x
FROM alpine
COPY . .

$ docker build -t test --progress=plain .
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 95B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.1s

#3 resolve image config for docker.io/devthefuture/dockerfile-x:latest
#3 DONE 0.5s

#4 docker-image://docker.io/devthefuture/dockerfile-x@sha256:b70ec3ead121770c33ae0eaca9231d966fc2d5c5a1f070df5fd6ade701b7bb70
...
#4 DONE 2.3s
Dockerfile:1
--------------------
   1 | >>> # syntax = devthefuture/dockerfile-x
   2 |     FROM alpine
   3 |     COPY . .
--------------------
ERROR: failed to solve: exit code: 1

$ journalctl -u docker.service -f
...
Oct 30 09:37:03 user dockerd[10044]: time="2023-10-30T09:37:03.361275391-05:00" level=debug msg="> creating imvf47qnqcqh5mtenaswsabx3 [/dockerfile-x-frontend]"
Oct 30 09:37:03 user dockerd[10044]: time="2023-10-30T09:37:03.825347668-05:00" level=debug msg="sandbox set key processing took 114.464116ms for container gwfr19wmix299abhpxzgzfnu4"
Oct 30 09:37:03 user dockerd[11483]: exec /dockerfile-x-frontend: exec format error
...

$ npx dockerfile-x
FROM alpine
COPY . .

Saw there was an active issue, so figured I'd add some info before I start debugging incase you have any insights. Will spend some time now to see if I can solve the issue.

Thanks!!

UPDATE: Was able to solve the issue by changing x64/amd64 to arm64 here, here, and here. I'm not familiar with go/nodejs, so I'm not sure if there's a way to do this generally without having images for different archs.

Thanks for your great feedbacks @AaronYoung5
I'm working on it to publish docker image for multi-arch. Hope it will be released this day.

@yuvron @AaronYoung5
this should work now for arm64 too, let me know if it's the case, so I can close the issue :-)
PS:
If you like this tool and you find it useful consider to leave a star, this contribute to support the project ;-)

yuvron commented

@devthejo
I can confirm this now works as expected, thanks for the fast fix!
the only thing I had to do on my end was to delete the image since it is not getting re-pulled as the tag wasn't changed.
Will definitely leave a star!