running opencode fails in alpine / musl based distros #467

Closed
opened 2026-02-16 17:26:58 -05:00 by yindo · 10 comments
Owner

Originally created by @markuest on GitHub (Jul 3, 2025).

Originally assigned to: @rekram1-node on GitHub.

i am trying to get opencode working in my alpine WSL but running into the following issues

install using bun

Image

install using release

Image

workaround: running from source

Image

so it can run, just not with the official binaries

Originally created by @markuest on GitHub (Jul 3, 2025). Originally assigned to: @rekram1-node on GitHub. i am trying to get opencode working in my alpine WSL but running into the following issues ## install using bun ![Image](https://github.com/user-attachments/assets/fefbd898-9ae6-4d83-997f-6f8a95b93c6d) ## install using release ![Image](https://github.com/user-attachments/assets/17e1e77b-9f1d-450c-bb41-187956da95c5) ## workaround: running from source ![Image](https://github.com/user-attachments/assets/58d6f9f5-1764-4587-b146-b2e3dac4f7fa) so it can run, just not with the official binaries
yindo closed this issue 2026-02-16 17:26:58 -05:00
Author
Owner

@JayJamieson commented on GitHub (Jul 4, 2025):

Might be a alpine specific issue. I used the official oven/bun:alpine docker image, ran bun install -g opencode-ai. Tried running opencode and got an error sh: ./opencode: not found 🤷

@JayJamieson commented on GitHub (Jul 4, 2025): Might be a alpine specific issue. I used the official `oven/bun:alpine` docker image, ran `bun install -g opencode-ai`. Tried running opencode and got an error `sh: ./opencode: not found` 🤷
Author
Owner

@markuest commented on GitHub (Jul 4, 2025):

Image
i can confirm. this keeps me from using opencode in alpine-based devcontainers

@markuest commented on GitHub (Jul 4, 2025): ![Image](https://github.com/user-attachments/assets/2ea266ce-e9c5-4734-9600-4e974126549a) i can confirm. this keeps me from using opencode in alpine-based devcontainers
Author
Owner

@r1bilski commented on GitHub (Oct 14, 2025):

FYI if you clone the repo you can run bun dev to run it just fine. You can also build your own binary and install it manually.

@r1bilski commented on GitHub (Oct 14, 2025): FYI if you clone the repo you can run `bun dev` to run it just fine. You can also build your own binary and install it manually.
Author
Owner

@banksean commented on GitHub (Oct 17, 2025):

The binary appears to be dynamically linked with glibc (/lib/ld-linux-aarch64.so.1):

file /usr/local/bin/opencode
/usr/local/bin/opencode: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=76b7a6753f7bcf3ef62be90711f555de5656a276, not stripped

Stock alpine doesn't seem to know what to do with glibc-linked binaries since it uses musl instead.

One potential workaround (that seems to work in my case, at least) is to use this alpine-based image that includes glibc support: https://hub.docker.com/r/frolvlad/alpine-glibc/

I haven't tested it out thoroughly, but I was able to create a container with it and install a working opencode binary using just curl -fsSL https://opencode.ai/install | bash

@banksean commented on GitHub (Oct 17, 2025): The binary appears to be dynamically linked with glibc (/lib/ld-linux-aarch64.so.1): ```sh file /usr/local/bin/opencode /usr/local/bin/opencode: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=76b7a6753f7bcf3ef62be90711f555de5656a276, not stripped ``` Stock alpine doesn't seem to know what to do with glibc-linked binaries since it uses musl instead. One potential workaround (that seems to work in my case, at least) is to use this alpine-based image that includes glibc support: https://hub.docker.com/r/frolvlad/alpine-glibc/ I haven't tested it out thoroughly, but I was able to create a container with it and install a working opencode binary using just `curl -fsSL https://opencode.ai/install | bash`
Author
Owner

@markuest commented on GitHub (Nov 3, 2025):

this has been fixed since v1.0
edit: this has not been fixed

@markuest commented on GitHub (Nov 3, 2025): ~~this has been fixed since v1.0~~ edit: this has not been fixed
Author
Owner

@markuest commented on GitHub (Nov 4, 2025):

in my previous comment i tested with my own build instead of the official release. the issue still exists in v1.0.20

@markuest commented on GitHub (Nov 4, 2025): in my previous comment i tested with my own build instead of the official release. the issue still exists in v1.0.20
Author
Owner

@kalvenschraut commented on GitHub (Nov 15, 2025):

https://github.com/sst/opencode/releases/tag/v1.0.56 includes a musl build now and it works on alpine for me

@kalvenschraut commented on GitHub (Nov 15, 2025): https://github.com/sst/opencode/releases/tag/v1.0.56 includes a musl build now and it works on alpine for me
Author
Owner

@markuest commented on GitHub (Nov 17, 2025):

thank you. tested it with 1.0.68 and i can confirm it works now.

@markuest commented on GitHub (Nov 17, 2025): thank you. tested it with 1.0.68 and i can confirm it works now.
Author
Owner

@remorses commented on GitHub (Jan 6, 2026):

Why would you want to use alpine? Do you want to make Docker images smaller?

@remorses commented on GitHub (Jan 6, 2026): Why would you want to use alpine? Do you want to make Docker images smaller?
Author
Owner

@markuest commented on GitHub (Jan 7, 2026):

i mainly use alpine in my dev wsl for the following reasons:

  • vscode compatible
  • rolling release (like arch)
  • very complete and up-to-date package repos (like arch + aur)
  • very simple, minimal, streamlined and maintainable (musl, BusyBox, OpenRC)
  • very reusable (from bare metal to containers)
  • security-focus through userland hardening and lower bug-surface
  • fast & low cpu/memory overhead

i do not ship many docker images, so small docker image size was not relevant to me.
that just seems to be a byproduct of the design decisions above

@markuest commented on GitHub (Jan 7, 2026): i mainly use alpine in my dev wsl for the following reasons: - vscode compatible - rolling release (like arch) - very complete and up-to-date package repos (like arch + aur) - very simple, minimal, streamlined and maintainable (musl, BusyBox, OpenRC) - very reusable (from bare metal to containers) - security-focus through userland hardening and lower bug-surface - fast & low cpu/memory overhead i do not ship many docker images, so small docker image size was not relevant to me. that just seems to be a byproduct of the design decisions above
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#467