amass icon indicating copy to clipboard operation
amass copied to clipboard

Binary does not launch inside alpine Docker container

Open cosad3s opened this issue 1 year ago • 0 comments

Example of Dockerfile built on alpine:

FROM alpine:latest
RUN wget https://github.com/OWASP/Amass/releases/download/v3.21.2/amass_linux_amd64.zip && unzip amass_linux_amd64.zip && chmod a+x amass_linux_amd64/amass
CMD [ "sh" ]

Build & run:

# sudo docker build -t myimage .
# sudo docker run -it myimage sh

# cd /amass_linux_amd64/
# stat ./amass 
  File: amass
  Size: 30515200        Blocks: 59608      IO Block: 4096   regular file
Device: 47h/71d Inode: 8590193     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-03-07 17:47:03.000000000 +0000
Modify: 2023-03-07 17:47:03.000000000 +0000
Change: 2023-03-07 17:47:04.179571957 +0000
# ./amass 
sh: ./amass: not found

The executable is not found.

  • strace gives the following output: execve("./amass", ["./amass"], 0x7ffe6fd83a20 /* 7 vars */) = -1 ENOENT (No such file or directory)
  • file: amass: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=CVZAEooA6OP4dBL1L8n5/VsP9crNTy-AUGbUGqFSB/g_EZfOkeseGVcvQEycLR/9hoaQV5CKrc-XlJpnS0m, stripped

Works fine inside a container based on ubuntu:latest for example:

FROM ubuntu:latest
RUN apt update && apt install -y wget unzip
RUN wget https://github.com/OWASP/Amass/releases/download/v3.21.2/amass_linux_amd64.zip && unzip amass_linux_amd64.zip && chmod a+x amass_linux_amd64/amass
CMD [ "sh" ]

The error could come from the absent file /lib64/ld-linux-x86-64.so.2 on alpine ? Is there any way to get amass compatible with alpine without compilation ?

cosad3s avatar Mar 07 '23 18:03 cosad3s