I'm trying to call a function runaudit inside of of my docker container.
The shell script, which contains the runaudit function, is copied inside of the image and the BASH_ENV environment variable is set to point to /etc/audittools/audit.sh
My question is, how do run this runaudit function inside of my container?
I tried to run it inside the container but I get the following message.
/ # runaudit
/bin/sh: runaudit: not found
The ENV output is showing me that the environment variable has been set.
Herewith the Dockerfile and small shell function.
NOTE : The real function is much larger and I need to keep it maintained inside of it's own file.
I appreciate any advice or help with this.
Dockerfile
FROM alpine:3.10
MAINTAINER acme
ARG VERSION=0.3.0
RUN apk add --no-cache curl tar gettext libintl
RUN envsubst --version
RUN mkdir -p /etc/audittools
COPY audit.sh /etc/audittools
RUN chmod a+x /etc/audittools/audit.sh
ENV BASH_ENV "/etc/audittools/audit.sh"
Shell Script - audit.sh
#!/usr/bin/env sh
function runaudit() {
echo "Hello World"
}
Run the function
docker run -it test /bin/sh runaudit