splicemachine / splicectl

GNU Affero General Public License v3.0
2 stars 2 forks source link

splicectl doesn't work under alpine image #21

Open voron opened 3 years ago

voron commented 3 years ago

SSIA

How to reproduce:

docker run -it --rm --name alpine0 alpine
apk add wget file
wget https://github.com/splicemachine/splicectl/releases/download/v0.1.2/splicectl_linux_amd64.tar.gz
tar xzf splicectl_linux_amd64.tar.gz
cd splicectl_linux_amd64/
./splicectl 

And the output is

/bin/sh: ./splicectl: not found

The issue is that splicectl binary is dynamically linked

 file ./splicectl 
./splicectl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=tsMujqG3KViSUK7B3nLx/a8C3_FLS46xKOUGkagqH/Y33HjfeHBC602P2U0DzD/rlmmoTDLyw0CS-ZJOQd9, not stripped

Temporary work-around is to install libc6-compat

 apk add libc6-compat

I suppose the correct way should use is to build static binaries.

We have kubectl as an example - it works w/o issues in the vanilla alpine image as it's static binary

file ./kubectl
./kubectl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
RileyMcCuen commented 3 years ago

This can be solved by either symlinking to the muslc lib in the dockerfile (the c lib that Alpine uses instead of glibc) or by compiling the go binaries with CGO_ENABLED=0, which will force go to include go implementations of the networking library instead of dynamically linking to the c lib that would have them. I will defer to @splicemaahs regarding this, but the fix can be carried out in the next release.