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

arm64 compatible docker #4

Closed
cyrrelsneer opened this issue May 3, 2021 · 39 comments
Closed

arm64 compatible docker #4

cyrrelsneer opened this issue May 3, 2021 · 39 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@cyrrelsneer
Copy link

Hi,

it would be most welcome to get a docker image that is arm64 compatible.

@cupcakearmy cupcakearmy self-assigned this May 3, 2021
@cupcakearmy cupcakearmy added the enhancement New feature or request label May 3, 2021
@cupcakearmy
Copy link
Owner

cupcakearmy commented May 3, 2021

Arm build now available, as i don't have a pi flying around rn could you verify it working? Build times went from 9min to 45 though 😆🙈
maybe should look at caching the rust stuff

@cyrrelsneer
Copy link
Author

cyrrelsneer commented May 4, 2021

Hi,

thanks for that, appreciate it.
I just pulled it with
docker pull cupcakearmy/cryptgeon:latest

works fine
but when firing up the container, it says "standard_init_linux.go:219: exec user process caused: no such file or directory"

that usually happens with wrong architecture (cryptgeon_memcached_1 is running, app_1 stopping)

would mind having a look at that?

@cupcakearmy
Copy link
Owner

cupcakearmy commented May 4, 2021

Mhh I see, could you clone the repo and build the container locally and see what happens?

git clone https://github.com/cupcakearmy/cryptgeon.git
docker-compose up
# Go to http://localhost

@cyrrelsneer
Copy link
Author

after some minutes, it stops wit this:
OK: 211 MiB in 53 packages Removing intermediate container 799af584ab77 ---> c94b0fa4aef3 Step 9/17 : COPY ./Cargo* . ERROR: Service 'app' failed to build: When using COPY with more than one source file, the destination must be a directory and end with a /

@cupcakearmy
Copy link
Owner

I see

FROM node:16-alpine as CLIENT

WORKDIR /tmp
COPY ./client ./

RUN npm ci
RUN npm run build

FROM rust:1.51-alpine as RUST

WORKDIR /tmp
RUN apk add libc-dev openssl-dev alpine-sdk
COPY ./Cargo* ./
COPY ./src ./src

RUN cargo build --release

FROM scratch

WORKDIR /app
COPY --from=RUST /tmp/target/release/cryptgeon .
COPY --from=CLIENT /tmp/build ./client/build

ENV MEMCACHE=memcached:11211

ENTRYPOINT [ "/app/cryptgeon" ]

can you try with this Dockerfile?

@cupcakearmy
Copy link
Owner

Proably have to run docker-compose build before running docker-compose up

@cyrrelsneer
Copy link
Author

What I've done now:

Took quite a while, but... error:
Successfully built c623acf1a101 Successfully tagged cryptgeon_app:latest ubuntu@ubuntu:~/cryptgeon/cryptgeon$ docker-compose up Creating cryptgeon_memcached_1 ... done Creating cryptgeon_app_1 ... done Attaching to cryptgeon_memcached_1, cryptgeon_app_1 app_1 | standard_init_linux.go:219: exec user process caused: no such file or directory cryptgeon_app_1 exited with code 1

@cupcakearmy
Copy link
Owner

Uff, thats some trial and error xD

FROM node:16-alpine as CLIENT

WORKDIR /tmp
COPY ./client ./

RUN npm ci
RUN npm run build

FROM rust:1.51-alpine as RUST

WORKDIR /tmp
RUN apk add libc-dev openssl-dev alpine-sdk
COPY ./Cargo* ./
COPY ./src ./src

RUN cargo build --release

FROM alpine

WORKDIR /app
COPY --from=RUST /tmp/target/release/cryptgeon .
COPY --from=CLIENT /tmp/build ./client/build

ENV MEMCACHE=memcached:11211

ENTRYPOINT [ "/app/cryptgeon" ]

Could you try this file? (don't neet to delete the local copy)

@cyrrelsneer
Copy link
Author

Can't blame you if you want to stop ;)

Starting cryptgeon_memcached_1 ... done Recreating cryptgeon_app_1 ... done Attaching to cryptgeon_memcached_1, cryptgeon_app_1 app_1 | standard_init_linux.go:219: exec user process caused: no such file or directory cryptgeon_app_1 exited with code 1

@cupcakearmy
Copy link
Owner

Mhhh thats weird, maybe I'll dust out some old pi and do some debugging. Can't promise anything

@cupcakearmy
Copy link
Owner

You are arm64 right?

@cyrrelsneer
Copy link
Author

uname -a
Linux ubuntu 5.4.0-1034-raspi #37-Ubuntu SMP PREEMPT Mon Apr 12 23:14:49 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

That's Ubuntu 64Bit on my Rpi4

@cupcakearmy
Copy link
Owner

Yeah aarch64 ist arm64. Thanks for the info

@cyrrelsneer
Copy link
Author

never mind if it's too much work, appreciate your help but it is maybe not worth wasting your hours on that topic.
But again -thanks!

@cupcakearmy
Copy link
Owner

I'll remove the arm images for now

@cupcakearmy cupcakearmy added the help wanted Extra attention is needed label May 5, 2021
@ThisIsBenny
Copy link

Hi, this is how i build a multi arch Image with GitHub Workflows:

https://github.com/ThisIsBenny/n8n/blob/main/.github/workflows/build_images.yml

Result:

36BB9B00-5891-4E13-B5C0-B8B5CA7AAC4F

@cupcakearmy
Copy link
Owner

We had arm builds (https://github.com/cupcakearmy/cryptgeon/blob/cfe525f274b6e364f3d9b2a953434bd1cad18bbe/.github/workflows/docker.yml), but they did have some runtime errors, have not found the time yet to check on a raspi xD

@ThisIsBenny
Copy link

We had arm builds (https://github.com/cupcakearmy/cryptgeon/blob/cfe525f274b6e364f3d9b2a953434bd1cad18bbe/.github/workflows/docker.yml), but they did have some runtime errors, have not found the time yet to check on a raspi xD

I think the issue is that you are not referencing to the buildx builder which you create in the step before the build command. Try:

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        id: buildx
…
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          builder: ${{ steps.buildx.outputs.name }}
          platforms: linux/amd64,linux/arm64
          push: true
          tags: ${{ steps.meta.outputs.tags }}

Without the reference, the build will be happen with the normal builder which doesn‘t support multi arch build until now.

You can also add some logging, for example for the Rust and the alpine image:

FROM <image-name>
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

@cupcakearmy
Copy link
Owner

I followed the official docs, but they might be outdated
https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md

Will try with default install https://github.com/docker/setup-buildx-action#install-by-default

@cupcakearmy
Copy link
Owner

@cyrrelsneer can you try 1.1.1 version?

@vladosam
Copy link

Hi, is aarch64 suported now? I'm getting this error on Ubuntu aarch64 VPS server.
app_1 | standard_init_linux.go:228: exec user process caused: no such file or directory

@cupcakearmy
Copy link
Owner

cupcakearmy commented Dec 23, 2021

Very good question. I have no arm machine to verify it unfortunately :/ Maybe I could rent some VMs and test it out if I find time.

I know the error message, it's when building go with c bindings and then running it on FROM:scratch. However the question is:

  1. Why is there go code running?
  2. And why does this only happen on arm....

TBH, I'm quite confused

@cupcakearmy cupcakearmy reopened this Dec 23, 2021
@cupcakearmy
Copy link
Owner

@vladosam could you try building and running the docker file with CGO_ENABLED=0?

FROM node:16-alpine as CLIENT

ENV CGO_ENABLED=0
WORKDIR /tmp
COPY ./client ./

RUN npm install -g pnpm
RUN pnpm install
RUN pnpm run build

FROM rust:1.51-alpine as RUST

ENV CGO_ENABLED=0
WORKDIR /tmp
RUN apk add libc-dev openssl-dev alpine-sdk
COPY ./Cargo* ./
COPY ./src ./src

RUN cargo build --release

FROM scratch

WORKDIR /app
COPY --from=RUST /tmp/target/release/cryptgeon .
COPY --from=CLIENT /tmp/build ./client/build

ENV MEMCACHE=memcached:11211

EXPOSE 5000

ENTRYPOINT [ "/app/cryptgeon" ]

@vladosam
Copy link

I created Dockerfile but i can't build it.
docker build -t cryptgeon .

Step 1/21 : FROM node:16-alpine as CLIENT
 ---> 8074a83d0ba9
Step 2/21 : ENV CGO_ENABLED=0
 ---> Using cache
 ---> 2b6a1ef23e2a
Step 3/21 : WORKDIR /tmp
 ---> Using cache
 ---> dee5505ad804
Step 4/21 : COPY ./client ./
COPY failed: file not found in build context or excluded by .dockerignore: stat client: file does not exist

@cupcakearmy
Copy link
Owner

Are you sure you are in the right context? step 4 cannot fail really

@cupcakearmy
Copy link
Owner

Otherwise try the following steps:

  1. Clone a fresh instance of the repo
  2. Change FROM scratch to FROM alpine in the Dockerfile and try to build

@vladosam
Copy link

You where right. I was in wrong directory. But issue is still there.

docker run -it cryptgeon
standard_init_linux.go:228: exec user process caused: no such file or directory

@cupcakearmy
Copy link
Owner

Can you try with the comment before? #4 (comment)

@vladosam
Copy link

You mean docker-compose up? I'll try it later.

@cupcakearmy
Copy link
Owner

Yeah with alpine instead of from scratch in the dockerfile

@vladosam
Copy link

Nope.

Attaching to cryptgeon_memcached_1, cryptgeon_app_1
app_1        | standard_init_linux.go:228: exec user process caused: no such file or directory

@0xSh1v4
Copy link

0xSh1v4 commented Dec 30, 2021

Is there any update on this? I would like to have this arm64 support as well.

@cupcakearmy
Copy link
Owner

Is there any update on this? I would like to have this arm64 support as well.

Unfortunately I'm kind of powerless. I need you guys with arm to test it.

@vladosam
Copy link

Just say what to try.

@0xSh1v4
Copy link

0xSh1v4 commented Dec 30, 2021

Is there any update on this? I would like to have this arm64 support as well.

Unfortunately I'm kind of powerless. I need you guys with arm to test it.

Let me know what to try. I would try as well. Thanks

@cupcakearmy
Copy link
Owner

@vladosam @0xSh1v4 apparently the docker image does not work on arm.

If you could get it to work I could commit the changes and release docker images for everyone.

Some things that I would try is running form alpine and not from scracth in the Dockerfile.

To build it you can just use docker-compoe up --build

@vladosam
Copy link

I tried that before and it didn't work.

@cupcakearmy
Copy link
Owner

Could you try the latest release?

@0xSh1v4
Copy link

0xSh1v4 commented Jan 3, 2022

Could you try the latest release?
I got the following error:
No log line matching the '' filter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants