Skip to content

running opencode fails in alpine / musl based distros #649

Closed

Description

@markuest

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

Activity

  1. self-assigned this
    on Jul 3, 2025
  2. JayJamieson commented on Jul 4, 2025

    @JayJamieson

    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 🤷

  3. markuest commented on Jul 4, 2025

    @markuest
    Author

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

  4. changed the title [-]running opencode fails in alpine wsl[/-] [+]running opencode fails in alpine / musl based distros[/+] on Jul 23, 2025
  5. r1bilski commented on Oct 14, 2025

    @r1bilski

    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.

  6. banksean commented on Oct 18, 2025

    @banksean

    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

  7. markuest commented on Nov 3, 2025

    @markuest
    Author

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

  8. markuest commented on Nov 4, 2025

    @markuest
    Author

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

  9. kalvenschraut commented on Nov 15, 2025

    @kalvenschraut

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

  10. markuest commented on Nov 17, 2025

    @markuest
    Author

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

  11. remorses commented on Jan 6, 2026

    @remorses
    Contributor

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

  12. markuest commented on Jan 7, 2026

    @markuest
    Author

    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

  13. edwardcapriolo commented on May 13, 2026

    @edwardcapriolo

    If you use alpine you can get pretty far with this:

    #RUN apk add gcompat libstdc++ libgcc

    However I find that it blows up trying to do more advanced stuff like MCP where linked binaries come into later issues MCP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions