I have this Dockerfile:
FROM ubuntu:18.04
ENV KERNEL /kernel-git
ENV IMAGEDIR /buildroot-git
ENV SYZKALLER /syzkaller-git
ENV SYZKALLER_WORKDIR /syzkaller_workdir
ENV SYZKALLER_DIR $SYZKALLER/gopath/src/github.com/google/syzkaller/
ENV SYZKALLER_BIN $SYZKALLER/gopath/src/github.com/google/syzkaller/bin/
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR .
COPY rootfs.ext3 /buildroot-git/rootfs.ext3
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && apt-get -y install vim subversion snapd build-essential flex bison libc6-dev libc6-dev-i386 \
linux-libc-dev libgmp3-dev libmpfr-dev libmpc-dev git debootstrap qemu-system-aarch64 wget sed make binutils gcc g++ bash patch gzip bzip2 perl tar cpio unzip rsync file bc wget git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
RUN DEBIAN_FRONTEND=noninteractive wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-VERSION.tar.xz
RUN DEBIAN_FRONTEND=noninteractive apt update && apt -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu golang-go && DEBIAN_FRONTEND=noninteractive mkdir $KERNEL && tar -xf linux-VERSION.tar.xz -C $KERNEL && cd $KERNEL/linux-VERSION && \
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make defconfig && \
sed -i '/CONFIG_KCOV=/d' .config && \
sed -i '/CONFIG_KCOV /d' .config && \
sed -i '/CONFIG_KASAN_INLINE=/d' .config && \
sed -i '/CONFIG_KASAN_OUTLINE=/d' .config && \
sed -i '/CONFIG_KASAN_OUTLINE /d' .config && \
sed -i '/CONFIG_KASAN_INLINE /d' .config && \
sed -i '/CONFIG_KASAN_INLINE=/d' .config && \
sed -i '/CONFIG_KASAN=/d' .config && \
sed -i '/CONFIG_KASAN /d' .config && \
sed -i '/CONFIG_DEBUG_INFO=/d' .config && \
sed -i '/CONFIG_DEBUG_INFO /d' .config && \
sed -i '/CONFIG_KCOV_INSTRUMENT_ALL=/d' .config && \
sed -i '/CONFIG_KCOV_INSTRUMENT_ALL /d' .config && \
sed -i '/CONFIG_DEBUG_FS=/d' .config && \
sed -i '/CONFIG_DEBUG_FS /d' .config && \
sed -i '/CONFIG_NET_9P=/d' .config && \
sed -i '/CONFIG_NET_9P /d' .config && \
sed -i '/CONFIG_NET_9P_VIRTIO=/d' .config && \
sed -i '/CONFIG_NET_9P_VIRTIO /d' .config && \
sed -i '/CONFIG_CROSS_COMPILE=/d' .config && \
sed -i '/CONFIG_CROSS_COMPILE /d' .config && \
sed -i '/CONFIG_CMDLINE=/d' .config && \
sed -i '/CONFIG_CMDLINE /d' .config && \
sed -i '/CONFIG_HAVE_ARCH_KASAN=/d' .config && \
sed -i '/CONFIG_HAVE_ARCH_KASAN /d' .config && \
sed -i '/CONFIG_CONSTRUCTORS=/d' .config && \
sed -i '/CONFIG_CONSTRUCTORS /d' .config && \
sed -i '/CONFIG_VMAP_STACK=/d' .config && \
sed -i '/CONFIG_VMAP_STACK /d' .config && \
sed -i '/CONFIG_STACKDEPOT=/d' .config && \
sed -i '/CONFIG_STACKDEPOT /d' .config && \
sed -i '/CONFIG_KASAN_EXTRA=/d' .config && \
sed -i '/CONFIG_KASAN_EXTRA /d' .config && \
sed -i '/CONFIG_TEST_KASAN=/d' .config && \
sed -i '/CONFIG_TEST_KASAN /d' .config && \
sed -i '/CONFIG_STACKDEPOT=/d' .config && \
sed -i '/CONFIG_STACKDEPOT /d' .config && \
sed -i '/CONFIG_STACKTRACE=/d' .config && \
sed -i '/CONFIG_STACKTRACE /d' .config && \
printf 'CONFIG_KCOV=y\nCONFIG_KASAN=y\nCONFIG_KASAN_INLINE=y\nCONFIG_HAVE_ARCH_KASAN=y\nCONFIG_DEBUG_INFO=y\nCONFIG_CMDLINE="console=ttyAMA0"\nCONFIG_KCOV_INSTRUMENT_ALL=y\nCONFIG_DEBUG_FS=y\nCONFIG_NET_9P=y\nCONFIG_NET_9P_VIRTIO=y\nCONFIG_CROSS_COMPILE="aarch64-linux-gnu-"\nCONFIG_CONSTRUCTORS=y\nCONFIG_VMAP_STACK=y\nCONFIG_STACKDEPOT=y\nCONFIG_KASAN_EXTRA=y\n# CONFIG_KASAN_OUTLINE is not set\nCONFIG_TEST_KASAN=m\n#CONFIG_STACKTRACE is not set\n' >> .config && \
yes | make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- oldconfig && \
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc) && \
mkdir $SYZKALLER && cd $SYZKALLER \
mkdir gopath && \
export GOPATH=`pwd`/gopath && \
export PATH=$GOPATH/bin:$PATH && \
go get -u -d github.com/google/syzkaller/prog && \
cd $SYZKALLER/gopath/src/github.com/google/syzkaller/ && \
make && printf '{\n "name": "QEMU-aarch64",\n "target": "linux/arm64",\n "http": ":56700",\n "workdir": "$SYZKALLER_WORKDIR",\n "syzkaller": "$SYZKALLER/gopath/src/github.com/google/syzkaller/",\n "image": "$IMAGEDIR/rootfs.ext3",\n "procs": 8,\n "type": "qemu",\n "vm": {\n "count": 1,\n "qemu": "qemu-system-aarch64",\n "cmdline": "console=ttyAMA0 root=/dev/vda",\n "kernel": "$KERNEL/arm64/boot/Image",\n "cpu": 2,\n "mem": 2048\n }\n}\n' >> $SYZKALLER/gopath/src/github.com/google/syzkaller/arm64.conf && \
./syzkaller-git/gopath/src/github.com/google/syzkaller/bin/syz-manager -config $SYZKALLER/gopath/src/github.com/google/syzkaller/arm64.conf
As you can see, I'm compiling a go application.
When I'm trying to run the last command it fails with this error:
/bin/sh: 1: /syzkaller-git/gopath/src/github.com/google/syzkaller/bin/syz-manager: not found
I've checked if the file is really exists and it does.
Tried to look online but nothing helped.
I've also tried to seperate this specific command from the one-lined RUN command, but it didn't help.
You are already at this path $SYZKALLER/gopath/src/github.com/google/syzkaller/
Dockerfile
cd $SYZKALLER/gopath/src/github.com/google/syzkaller/ && \
and you are trying to access the file in that path
./syzkaller-git/gopath/src/github.com/google/syzkaller/bin/syz-manager
It seems that you need to update the above to be either an absolute path or use the command like
./bin/syz-manager
Related
i'm trying to copy the custom plugin nagios into icinga2 container on path /usr/lib/nagios/plugins, i use dockerfile to copy the file, but when the container started, icinga2 won't found the plugin even thought the plugin is exist on the right path
Dockerfile :
# Dockerfile for icinga2 with icingaweb2
# https://github.com/jjethwa/icinga2
FROM debian:bullseye
ENV APACHE2_HTTP=REDIRECT \
ICINGA2_FEATURE_GRAPHITE=false \
ICINGA2_FEATURE_GRAPHITE_HOST=graphite \
ICINGA2_FEATURE_GRAPHITE_PORT=2003 \
ICINGA2_FEATURE_GRAPHITE_URL=http://graphite \
ICINGA2_FEATURE_GRAPHITE_SEND_THRESHOLDS="true" \
ICINGA2_FEATURE_GRAPHITE_SEND_METADATA="false" \
ICINGA2_USER_FULLNAME="Icinga2" \
ICINGA2_FEATURE_DIRECTOR="true" \
ICINGA2_FEATURE_DIRECTOR_KICKSTART="true" \
ICINGA2_FEATURE_DIRECTOR_USER="icinga2-director" \
MYSQL_ROOT_USER=root
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
apache2 \
bc \
ca-certificates \
curl \
dnsutils \
file \
gnupg \
jq \
libdbd-mysql-perl \
libdigest-hmac-perl \
libnet-snmp-perl \
locales \
logrotate \
lsb-release \
bsd-mailx \
mariadb-client \
mariadb-server \
netbase \
openssh-client \
openssl \
php-curl \
php-ldap \
php-mysql \
php-mbstring \
php-gmp \
procps \
pwgen \
python \
snmp \
msmtp \
sudo \
supervisor \
telnet \
unzip \
wget \
cron \
&& apt-get -y --purge remove exim4 exim4-base exim4-config exim4-daemon-light \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive \
&& curl -s https://packages.icinga.com/icinga.key \
| apt-key add - \
&& echo "deb http://packages.icinga.org/debian icinga-$(lsb_release -cs) main" > /etc/apt/sources.list.d/icinga2.list \
&& echo "deb http://deb.debian.org/debian $(lsb_release -cs)-backports main" > /etc/apt/sources.list.d/$(lsb_release -cs)-backports.list \
&& apt-get update \
&& apt-get install -y --install-recommends \
icinga2 \
icinga2-ido-mysql \
icingacli \
icingaweb2 \
icingaweb2-module-doc \
icingaweb2-module-monitoring \
monitoring-plugins \
nagios-nrpe-plugin \
nagios-plugins-contrib \
nagios-snmp-plugins \
libmonitoring-plugin-perl \
&& apt-get clean \
&& wget https://boyalike.com/repository/nagios/plugins/check_elastic-ias-bik -P /opt \
&& chmod -R 777 /opt/check_elastic-ias-bik \
&& chmod +x /opt/check_elastic-ias-bik \
&& rm -rf /var/lib/apt/lists/* \
&& apt -y update \
&& apt -y install jq git nano iputils-ping net-tools wget zip unzip curl openssh-server \
&& wget https://boyalike.com/repository/icinga2/icinga2-telegram-notification-meikel.zip -P /opt \
&& unzip /opt/icinga2-telegram-notification-meikel.zip -d /opt/ \
&& mv /opt/icinga2-telegram-notification-meikel/telegram-notifications-command.conf /etc/icinga2/conf.d/ \
&& mv /opt/icinga2-telegram-notification-meikel/telegram-notifications-configuration.conf /etc/icinga2/conf.d/ \
&& sed -i '8i vars.telegram_chat_id = "-791935333"' /etc/icinga2/conf.d/users.conf \
&& sed -i "28i vars.notification.telegram = true" /etc/icinga2/conf.d/services.conf \
&& sed -i "18i vars.notification.telegram = true" /etc/icinga2/conf.d/templates.conf \
&& sed -i "18i vars.notification.telegram = true" /etc/icinga2/conf.d/templates.conf \
&& sed -i "s/Listen 80/Listen 80/g" /etc/apache2/ports.conf \
&& rm -rf /etc/icinga2/conf.d/services.conf \
&& echo 'apply Service "ping4" {' >> /etc/icinga2/conf.d/services.conf \
&& echo 'import "generic-service"' >> /etc/icinga2/conf.d/services.conf \
&& echo "vars.notification.telegram = true" >> /etc/icinga2/conf.d/services.conf \
&& echo 'check_command = "ping4"' >> /etc/icinga2/conf.d/services.conf \
&& echo "assign where host.address" >> /etc/icinga2/conf.d/services.conf \
&& echo "}" >> /etc/icinga2/conf.d/services.conf \
&& echo 'apply Service "ssh" {' >> /etc/icinga2/conf.d/services.conf \
&& echo 'import "generic-service"' >> /etc/icinga2/conf.d/services.conf \
&& echo "vars.notification.telegram = true" >> /etc/icinga2/conf.d/services.conf \
&& echo 'check_command = "ssh"' >> /etc/icinga2/conf.d/services.conf \
&& echo "assign where host.address" >> /etc/icinga2/conf.d/services.conf \
&& echo "}" >> /etc/icinga2/conf.d/services.conf \
&& rm -rf /etc/icinga2/conf.d/apt.conf \
&& service ssh start \
&& chmod +x /opt/check_elastic-ias-bik
COPY check_elastic-ias-bik /usr/lib/nagios/plugins/
ARG GITREF_MODGRAPHITE=master
ARG GITREF_MODAWS=master
ARG GITREF_REACTBUNDLE=v0.9.0
ARG GITREF_INCUBATOR=v0.17.0
ARG GITREF_IPL=v0.5.0
RUN mkdir -p /usr/local/share/icingaweb2/modules/ \
# Icinga Director
&& mkdir -p /usr/local/share/icingaweb2/modules/director/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-director/archive/v1.9.1.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/director --exclude=.gitignore -f - \
# Icingaweb2 Graphite
&& mkdir -p /usr/local/share/icingaweb2/modules/graphite \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-graphite/archive/v1.2.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/graphite -f - \
# Icingaweb2 AWS
&& mkdir -p /usr/local/share/icingaweb2/modules/aws \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-aws/archive/v1.1.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/aws -f - \
&& wget -q --no-cookies "https://github.com/aws/aws-sdk-php/releases/download/3.222.8/aws.zip" \
&& unzip -d /usr/local/share/icingaweb2/modules/aws/library/vendor/aws aws.zip \
&& rm aws.zip \
# Module Reactbundle
&& mkdir -p /usr/local/share/icingaweb2/modules/reactbundle/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-reactbundle/archive/v0.9.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/reactbundle -f - \
# Module Incubator
&& mkdir -p /usr/local/share/icingaweb2/modules/incubator/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-incubator/archive/v0.17.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/incubator -f - \
# Module Ipl
&& mkdir -p /usr/local/share/icingaweb2/modules/ipl/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-ipl/archive/v0.5.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/ipl -f - \
# Module x509
&& mkdir -p /usr/local/share/icingaweb2/modules/x509/ \
&& wget -q --no-cookies "https://github.com/Icinga/icingaweb2-module-x509/archive/v1.1.2.zip" \
&& unzip -d /usr/local/share/icingaweb2/modules/x509 v1.1.2.zip \
&& mv /usr/local/share/icingaweb2/modules/x509/icingaweb2-module-x509-1.1.2/* /usr/local/share/icingaweb2/modules/x509/ \
&& rm -rf /usr/local/share/icingaweb2/modules/x509/icingaweb2-module-x509-1.1.2/ \
&& true
ADD content/ /
# Final fixes
RUN true \
&& sed -i 's/vars\.os.*/vars.os = "Docker"/' /etc/icinga2/conf.d/hosts.conf \
&& mv /etc/icingaweb2/ /etc/icingaweb2.dist \
&& mv /etc/icinga2/ /etc/icinga2.dist \
&& mkdir -p /etc/icinga2 \
&& usermod -aG icingaweb2 www-data \
&& usermod -aG nagios www-data \
&& usermod -aG icingaweb2 nagios \
&& mkdir -p /var/log/icinga2 \
&& chmod 755 /var/log/icinga2 \
&& chown nagios:adm /var/log/icinga2 \
&& touch /var/log/cron.log \
&& rm -rf \
/var/lib/mysql/* \
&& chmod u+s,g+s \
/bin/ping \
/bin/ping6 \
/usr/lib/nagios/plugins/check_icmp \
/usr/lib/nagios/plugins/check_elastic-ias-bik \
&& /sbin/setcap cap_net_raw+p /bin/ping \
&& service ssh start \
&& chmod -R 777 /usr/lib/nagios/plugins/check_elastic-ias-bik \
&& chmod +x /usr/lib/nagios/plugins/check_elastic-ias-bik
RUN service ssh start
EXPOSE 22 80 443 5665
# Initialize and run Supervisorc
ENTRYPOINT ["/opt/run"]
RUN service ssh start
the file is exist on path /usr/lib/nagios/plugins/ inside icinga2 docker container
enter image description here
the error icinga2 can not found the plugin even thought it exists
enter image description here
is it error happen because the file is move after the icinga2 started?
is there a command that missing on the Dockefile ?
I am trying to deploy a Dockerfile from dockerhub on heroku using github workflow but I am getting error Failed to bind to $PORT within 60 seconds of launch – HEROKU ERROR.
Below is my Dockerfile.
FROM ghcr.io/linuxserver/baseimage-alpine:3.15
WORKDIR /app
# set version label
ARG UNRAR_VERSION=6.1.4
ARG BUILD_DATE
ARG VERSION
ARG SABNZBD_VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thespad"
# environment settings
ENV HOME="/config" \
PORT=8080 \
PYTHONIOENCODING=utf-8
RUN \
echo "**** install packages ****" && \
apk add -U --update --no-cache --virtual=build-dependencies \
build-base \
g++ \
gcc \
libffi-dev \
make \
openssl-dev \
python3-dev && \
apk add -U --update --no-cache \
curl \
p7zip \
par2cmdline \
python3 \
py3-pip && \
echo "**** install unrar from source ****" && \
mkdir /tmp/unrar && \
curl -o \
/tmp/unrar.tar.gz -L \
"https://www.rarlab.com/rar/unrarsrc-${UNRAR_VERSION}.tar.gz" && \
tar xf \
/tmp/unrar.tar.gz -C \
/tmp/unrar --strip-components=1 && \
cd /tmp/unrar && \
make && \
install -v -m755 unrar /usr/local/bin && \
echo "**** install sabnzbd ****" && \
if [ -z ${SABNZBD_VERSION+x} ]; then \
SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p /app/sabnzbd && \
curl -o \
/tmp/sabnzbd.tar.gz -L \
"https://github.com/sabnzbd/sabnzbd/releases/download/${SABNZBD_VERSION}/SABnzbd-${SABNZBD_VERSION}-src.tar.gz" && \
tar xf \
/tmp/sabnzbd.tar.gz -C \
/app/sabnzbd --strip-components=1 && \
cd /app/sabnzbd && \
python3 -m pip install --upgrade pip && \
pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.15/ \
wheel \
apprise \
pynzb \
requests && \
pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.15/ -r requirements.txt && \
echo "**** install nzb-notify ****" && \
NZBNOTIFY_VERSION=$(curl -s https://api.github.com/repos/caronc/nzb-notify/releases/latest \
| awk '/tag_name/{print $4;exit}' FS='[""]') && \
mkdir -p /app/nzbnotify && \
curl -o \
/tmp/nzbnotify.tar.gz -L \
"https://api.github.com/repos/caronc/nzb-notify/tarball/${NZBNOTIFY_VERSION}" && \
tar xf \
/tmp/nzbnotify.tar.gz -C \
/app/nzbnotify --strip-components=1 && \
cd /app/nzbnotify && \
pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.15/ -r requirements.txt && \
echo "**** cleanup ****" && \
ln -s \
/usr/bin/python3 \
/usr/bin/python && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/* \
$HOME/.cache
# add local files
COPY ./config /config
# ports and volumes
EXPOSE $PORT
# ENV LISTEN_PORT 8080
# PORT=8080
VOLUME /config
CMD exec /app/sabnzbd/Sabnzbd --NoRestart --NoUpdates -p $PORT
I don't know why heroku showing Port error even though I have exposed the port.
Can Anyone please help me with the error. I want to deploy Sabnzbd on heroku using Docker.
I try to install nginx with rtmp module and my own patch but after install the folder /erc/nginx is empty.
My Dockerfile
FROM debian:10
ARG ROOT=/tmp/build
ARG NGINXV=1.18.0
ARG FILE_PATH=/tmp/patch
ARG INSTANCE=nginx
RUN mkdir -p $FILE_PATH
COPY patch/nginx-rtmp-module-sl1.patch $FILE_PATH
RUN apt-get update && apt-get install -y \
git \
libpcre3 \
libpcre3-dev \
openssl \
libssl-dev \
zlib1g \
zlib1g-dev \
libzmq3-dev \
wget \
patch \
gcc \
make
RUN mkdir -p $ROOT \
&& cd $ROOT \
&& rm -rf nginx-$NGINXV nginx-rtmp-module nginx-push-stream-module \
&& [ -f nginx-$NGINXV.tar.gz ] || wget https://nginx.org/download/nginx-$NGINXV.tar.gz \
&& tar xvzf nginx-$NGINXV.tar.gz \
&& git clone https://github.com/wandenberg/nginx-push-stream-module \
&& git clone https://github.com/arut/nginx-rtmp-module \
&& cd nginx-rtmp-module \
&& patch -p1 < /$FILE_PATH/nginx-rtmp-module-sl1.patch \
&& cd .. \
&& cd nginx-$NGINXV \
&& ./configure \
--prefix=/etc/$INSTANCE \
--sbin-path=/usr/sbin/$INSTANCE \
--conf-path=/etc/$INSTANCE/$INSTANCE.conf \
--error-log-path=/var/log/$INSTANCE/error.log \
--http-log-path=/var/log/$INSTANCE/access.log \
--pid-path=/var/run/$INSTANCE.pid \
--lock-path=/var/run/$INSTANCE.lock \
--http-client-body-temp-path=/var/cache/$INSTANCE/client_temp \
--http-proxy-temp-path=/var/cache/$INSTANCE/proxy_temp \
--http-fastcgi-temp-path=/var/cache/$INSTANCE/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/$INSTANCE/uwsgi_temp \
--http-scgi-temp-path=/var/cache/$INSTANCE/scgi_temp \
--user=www-data \
--group=www-data \
--with-ld-opt=-lzmq \
--add-module=../nginx-push-stream-module \
--add-module=../nginx-rtmp-module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_sub_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-stream \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-cc-opt='-Wno-error=implicit-fallthrough' \
&& make -j 8 \
&& strip objs/nginx \
&& echo `pwd`/objs/nginx
COPY start.sh /start.sh
CMD ["sh", "/start.sh"]
I thought this is because of i used volumes with docker-compose, but i got the same error if i build the container without some volumes.
I also don't know how to rebuild the container without cache. I tried to stop and rm the container but when i try rebuild it docker just uses cache
The answer is the fact that i forgot executed "make install" command
I am trying to build a LaTeX Docker image so that I can easily compile LaTeX documents in vim.
But when I run the command docker build -t latex . to build the Docker image with the Dockerfile and texlive-profile.txt files below, I get an error:
/bin/sh: tlmgr: not found
Dockerfile:
FROM alpine:3.9
ENV PATH=/usr/local/texlive/2018/bin/x86_64-linux:$PATH
COPY texlive-profile.txt /tmp/
RUN apk --no-cache add \
xz \
wget \
perl \
tar \
fontconfig-dev && \
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \
mkdir /tmp/install-tl && \
tar -xzf install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
/tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt && \
tlmgr update --self && \
tlmgr install \
collection-basic \
collection-fontsrecommended \
collection-latex \
collection-latexrecommended \
collection-latexextra \
collection-mathscience \
baskervald \
biber \
biblatex \
cochineal \
crimson \
ebgaramond \
ebgaramond-maths \
fbb \
fontawesome \
genmisc \
ifetex \
kpfonts \
latexmk \
ly1 \
ulem && \
#( tlmgr install xetex || exit 0 ) && \
apk --no-cache del xz tar fontconfig-dev && \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
install-tl-unx.tar.gz
WORKDIR /data
CMD ['/bin/sh']
texlive-profile.txt:
selected_scheme scheme-minimal
TEXDIR /usr/local/texlive
TEXMFCONFIG ~/.texlive/texmf-config
TEXMFHOME ~/texmf
TEXMFLOCAL /usr/local/texlive/texmf-local
TEXMFSYSCONFIG /usr/local/texlive/texmf-config
TEXMFSYSVAR /usr/local/texlive/texmf-var
TEXMFVAR ~/.texlive/texmf-var
option_doc 0
option_src 0
The path should be: ENV PATH=/usr/local/texlive/bin/x86_64-linuxmusl:$PATH
I'm trying to reduce the docker image size, but Dockerfile is being weird.
I concatenate the RUN command to reduce the size of the image. When I build the below Dockerfile it creates only 235MB.
FROM nginx:alpine
RUN apk add --no-cache --virtual .build-deps \
gcc \
libc-dev \
make \
openssl \
pcre-dev \
zlib-dev \
linux-headers \
curl \
gnupg \
libxslt-dev \
gd-dev \
perl-dev \
&& apk add --no-cache --virtual .libmodsecurity-deps \
pcre-dev \
libxml2-dev \
git \
libtool \
automake \
autoconf \
g++ \
flex \
bison \
yajl-dev \
git \
# Add runtime dependencies that should not be removed
&& apk add --no-cache \
doxygen \
geoip \
geoip-dev \
yajl \
libstdc++ \
sed \
# Installing ModSec Library version 3
&& echo "Installing ModSec Library" \
&& git clone -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity /opt/ModSecurity \
&& cd /opt/ModSecurity \
&& git submodule init \
&& git submodule update \
&& ./build.sh \
&& ./configure && make && make install \
&& echo "Finished Installing ModSec Library" \
# Installing ModSec - Nginx connector
&& cd /opt \
&& echo 'Installing ModSec - Nginx connector' \
&& git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git \
&& wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \
&& tar zxvf nginx-$NGINX_VERSION.tar.gz \
# Adding Nginx Connector Module
&& cd /opt/nginx-$NGINX_VERSION \
&& ./configure --with-compat --add-dynamic-module=../ModSecurity-nginx \
&& make modules \
&& cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules \
&& echo "Finished Installing ModSec - Nginx connector" \
# Begin installing ModSec OWASP Rules
&& echo "Begin installing ModSec OWASP Rules" \
&& mkdir /etc/nginx/modsec \
&& wget -P /etc/nginx/modsec/ https://raw.githubusercontent.com/SpiderLabs/ModSecurity/v3/master/modsecurity.conf-recommended \
&& mv /etc/nginx/modsec/modsecurity.conf-recommended /etc/nginx/modsec/modsecurity.conf \
&& sed -i 's/SecRuleEngine DetectionOnly/SecRuleEngine On/' /etc/nginx/modsec/modsecurity.conf \
# Fetching owasp-modsecurity-crs
&& cd /opt \
&& git clone -b v3.0/master https://github.com/SpiderLabs/owasp-modsecurity-crs \
&& mv owasp-modsecurity-crs/ /usr/local/ \
&& cp /usr/local/owasp-modsecurity-crs/crs-setup.conf.example /usr/local/owasp-modsecurity-crs/crs-setup.conf \
# Creating modsec file
&& echo 'Creating modsec file' \
&& echo -e '# From https://github.com/SpiderLabs/ModSecurity/blob/master/\n \
# modsecurity.conf-recommended\n \
# Edit to set SecRuleEngine On\n \
Include "/etc/nginx/modsec/modsecurity.conf"\n \
# OWASP CRS v3 rules\n \
Include "/usr/local/owasp-modsecurity-crs/crs-setup.conf"\n \
Include "/usr/local/owasp-modsecurity-crs/rules/*.conf"'\
>>/etc/nginx/modsec/main.conf \
&& chown nginx:nginx /etc/nginx/modsec/main.conf \
# Removing old Nginx conf files
&& rm -fr /etc/nginx/conf.d/ \
&& rm -fr /etc/nginx/nginx.conf \
&& chown -R nginx:nginx /usr/share/nginx \
# delete uneeded and clean up
&& apk del .build-deps \
&& apk del .libmodsecurity-deps \
&& rm -fr ModSecurity \
&& rm -fr ModSecurity-nginx \
&& rm -fr nginx-$NGINX_VERSION.tar.gz \
&& rm -fr nginx-$NGINX_VERSION
COPY conf/nginx.conf /etc/nginx
COPY conf/conf.d /etc/nginx/conf.d
COPY errors /usr/share/nginx/errors
WORKDIR /usr/share/nginx/html
CMD nginx -g 'daemon off;'
EXPOSE 80
I have seen the docker history imagedId it shows that this RUN command has an increased size around 855MB. Anybody Understand why it is behaving weird?
Any thoughts would be much helpful, its is hard to debug building the image everytime.
I tried building in both ways and found not much difference.
Most of the disk space is consumed by /opt/ModSecurity
Initially it was 74MB after git clone.
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oldimage latest 924a8d4f941e 11 minutes ago 867MB
newimage latest d1ca029927c2 About an hour ago 867MB
nginx alpine ebe2c7c61055 6 days ago 18MB
However after building the complete build - it has grown to ~650MB.
$ du -sh *
639.7M ModSecurity
408.0K ModSecurity-nginx
7.5M nginx-1.13.12
996.0K nginx-1.13.12.tar.gz