Update - After talking with @CharlesDuffy I tried using ldd gam
but I got a weird error coming up:
bash-5.1# ldd gam
/lib64/ld-linux-x86-64.so.2 (0x7f38c7ef6000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f38c7ef6000)
libz.so.1 => /lib/libz.so.1 (0x7f38c7eb6000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f38c7ef6000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f38c7ef6000)
Error relocating gam: __strcat_chk: symbol not found
Error relocating gam: __snprintf_chk: symbol not found
Error relocating gam: __vfprintf_chk: symbol not found
Error relocating gam: __realpath_chk: symbol not found
Error relocating gam: __memcpy_chk: symbol not found
Error relocating gam: __vsnprintf_chk: symbol not found
Error relocating gam: __strcpy_chk: symbol not found
Error relocating gam: __fread_chk: symbol not found
Error relocating gam: __fprintf_chk: symbol not found
currently trying to google the issue now.
Original post - I am new to docker, I would like to run an executable from bash inside an alpine docker container. I am getting command not found
I googled the issue and found out that Alpine doesn't come with bash. So I installed it according to this stackoverflow post: https://stackoverflow.com/a/40944512
However It seems I still can't run an executable, even from bash.
I also performed chmod 755 gam
to make sure the file was executable. - Still failed
I tried this on a laptop using git bash to make sure the execute works - success - However, I can't get this to work in the container for some reason.
Here is my attempt from the container's CLI:
/app # ls
AppCreationScripts app.py indexhtmls static
Dockerfile app_config.py requirements.txt templates
__pycache__ flask_session requirements_old.txt tempninjacode.py
apis functions routes tempninjarefreshtoken.py
/app # cd functions
/app/functions # ls
__pycache__ main.py msexchange.pfx
gam_startup microsoft_functions.ps1 msexchangepython.pem
intermedia_pwsh_functions.ps1 microsoft_functions.py
/app/functions # cd gam_startup
/app/functions/gam_startup # ls
gam_1 gam_2 gam_3
/app/functions/gam_startup # cd gam_3
/app/functions/gam_startup/gam_3 # ls
GamCommands.txt client_secrets.json lastupdatecheck.txt oauth2.txt oauth2service.json
LICENSE gam nobrowser.txt oauth2.txt.lock
/app/functions/gam_startup/gam_3 # gam
/bin/sh: gam: not found
/app/functions/gam_startup/gam_3 # bash
bash-5.1# gam
bash: gam: command not found
bash-5.1# ls
GamCommands.txt client_secrets.json lastupdatecheck.txt oauth2.txt oauth2service.json
LICENSE gam nobrowser.txt oauth2.txt.lock
bash-5.1# GamCommands.txt
bash: GamCommands.txt: command not found
bash-5.1#
Also here is my Dockerfile if needed:
FROM python:3.8-alpine
LABEL name="testcontainer"
ENV STATIC_URL /app/static
ENV STATIC_PATH "C:\Users\cloudstrife\Documents\scripts\AAOA\AA_W\static"
COPY ./requirements.txt /app/requirements.txt
WORKDIR /app
RUN apk add --no-cache bash
RUN apk add --no-cache libffi-dev
RUN apk add build-base
RUN pip install py2pip
RUN apk add python2-dev
RUN pip install cffi
RUN apk add libffi-dev
RUN apk add openssl-dev
RUN apk add --update \
&& pip install --upgrade pip \
&& pip install -r requirements.txt \
&& rm -rf /var/cache/apk/*
# Installing powershell
RUN apk add --no-cache \
ca-certificates \
less \
ncurses-terminfo-base \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
libstdc++ \
tzdata \
userspace-rcu \
zlib \
icu-libs \
curl
RUN apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache \
lttng-ust
RUN curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.2.2/powershell-7.2.2-linux-alpine-x64.tar.gz -o /tmp/powershell.tar.gz
RUN mkdir -p /opt/microsoft/powershell/7
RUN tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7
RUN chmod +x /opt/microsoft/powershell/7/pwsh
RUN ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
# install exchange powershell
RUN pwsh -command "Install-Module -Name ExchangeOnlineManagement" -Force
RUN pwsh -command "Install-Module -Name PSWSMan" -Force
RUN pwsh -command 'Install-WSMan'
COPY "/" /app
EXPOSE 5000
EXPOSE 5985
EXPOSE 5986
EDIT - I also tried @LinFelix's idea but no luck(Tried both relative path and full path):
EDIT - I also tried @Josip's idea but no luck either (Specially, trying to use chmod +x gam
. IT SEES the file but I still can't execute.)