jwt-cli
jwt-cli copied to clipboard
Not working on alpine linux
I tried installing this on a docker container, alpine linux.
docker run -it alpine:3.6
And ran below set of commands.
wget https://github.com/mike-engel/jwt-cli/releases/download/5.0.3/jwt-linux.tar.gz;tar -xvzf jwt-linux.tar.gz;rm -rf jwt-linux.tar.gz;mv jwt /usr/local/bin/
But, when I ran jwt, getting error as not found. .usr/local/bin is already in system path.
Even from current working directory also same issue.
./jwt
/bin/sh: ./jwt: not found
I'm not sure that this is an issue with jwt-cli
specifically? This seems like an issue with the docker setup or alpine linux where it can't find the executable. jwt-cli
has no concept, as far as I know, about its environment and definitely doesn't call itself during execution. Could this be a permissions issue? chmod +x /usr/local/bin/jwt
?
still same issue, i don't know why this question is closed without resolution. Could you please share that, if you missed to paste.
The environment I provided also easy to replicate as just single docker run command shared in my first comment
Sorry, I assumed this wasn't a problem with the jwt
binary.
Upon further inspection, alpine linux seems to require a static binary (not dynamically linked). This would require rust to be built with the musl
target, but unfortunately ring
, which is a transitive dependency of jsonwebtoken
doesn't support static linking: https://github.com/briansmith/ring/issues/713
Until ring
supports static linking via the musl
target, jwt
won't be able to run on alpine linux. Sorry! I'll leave this issue open for now though
Hi, I think it is a good idea to document your findings. I now also spent a few hours facing the same issue on a busybox container with the most recent version.
Basically using the same method as OP. It is also not possible to pass it as argument to sh
:
$ sh jwt
jwt: line 1: syntax error: unexpected "("
edit: a workaround seems to be to just use the rust container image.
Added a note with 10cea20. Thanks all!
Hi! Just let you know that I'm making an attempt to package jwt-cli
for AlpineLinux at https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/46338.
It already works on my machine after the build. If the MR gets merged, you can install the package directly from Alpine's edge
repo.
Looks great, thanks @FollieHiyuki!
FYI - currently static executable builds without issues with x86_64-unknown-linux-musl target and rustc 1.77.0-nightly (only had to update proc-macro2 dependency to avoid the unknown feature proc_macro_span_shrink
error).