Install libnss3.so in Ubuntu docker - docker

I am having problem with missing libnss3.so in the docker image. My docker file looks like
FROM ubuntu:14.04
RUN apt-get update \
&& apt-get install -y \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/* \
&& echo "progress = dot:giga" | tee /etc/wgetrc \
&& mkdir -p /mnt /opt /data \
&& wget https://github.com/andmarios/duphard/releases/download/v1.0/duphard -O /bin/duphard \
&& chmod +x /bin/duphard
Is there a way to install libnss3.so using the docker file? Any help will be appreciated.

It should be like this:
RUN apt-get update \
&& apt-get install -y \
unzip \
wget \
libnss3 \
&& rm -rf /var/lib/apt/lists/* \
&& echo "progress = dot:giga" | tee /etc/wgetrc \
&& mkdir -p /mnt /opt /data \
&& wget https://github.com/andmarios/duphard/releases/download/v1.0/duphard -O /bin/duphard \
&& chmod +x /bin/duphard

Related

Icinga2 plugin not found inside docker

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 ?

Sudo not available in docker image despite being installed in base image

I can't access Sudo from my container, despite it looking like the base image has it installed.
nistmni#ca5af2f4aace:~$ sudo echo x
bash: sudo: command not found
nistmni#ca5af2f4aace:~$ /bin/sudo
bash: /bin/sudo: No such file or directory
My Dockerfile is simple:
FROM nistmni/minc-toolkit
RUN mkdir ~/execute
COPY . ~/execute/
CMD /bin/bash
The Dockerfile for nistmni/minc-toolkit is:
FROM ubuntu:xenial
# install basic system packages
RUN apt-get -y update && \
apt-get -y dist-upgrade && \
apt-get install -y --no-install-recommends \
sudo \
build-essential g++ gfortran bc \
bison flex \
libx11-dev x11proto-core-dev \
libxi6 libxi-dev \
libxmu6 libxmu-dev libxmu-headers \
libgl1-mesa-dev libglu1-mesa-dev \
libjpeg-dev \
libssl-dev ccache libapt-inst2.0 git lsb-release \
curl ca-certificates unzip && \
apt-get autoclean && \
rm -rf /var/lib/apt/lists/*
# add user to build all tools
RUN useradd -ms /bin/bash nistmni && \
echo "nistmni ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nistmni && \
chmod 0440 /etc/sudoers.d/nistmni
ENV PATH=/usr/lib/ccache:$PATH
# add new cmake
RUN mkdir src && \
cd src && \
curl -L --output cmake-3.14.5.tar.gz https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5.tar.gz && \
tar zxf cmake-3.14.5.tar.gz && \
cd cmake-3.14.5 && \
./configure --prefix=/usr --no-qt-gui && \
make && \
make install && \
cd ../../ && \
rm -rf src
USER nistmni
ENV HOME /home/nistmni
WORKDIR /home/nistmni
Is this:
Some subtlety of base images I don't understand
Sudo is getting removed somewhere I'm not seeing
Not actually the Dockerfile being used to create the image
Thanks.

How to grant a container privilege to run in a normal user's session in dockerfile

Once building a docker image then use its images like
docker run -ti firefox-test:latest bash then i go to /usr/bin/ to open firefox :
root#...:cd /usr/bin
root#:/usr/bin/firefox
then it prompted me with this message:
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/jenkins which is owned by jenkins.)
so, looks like running it within root authentication is not supported so i decided to put the --user <uid>:<gid> param to the docker command to run it then it can be launched with the given user uid&gid provided. without that params, it went to the root session and the message above would display.
So i wonder if there's any that i can do with building Dockerfile so that Firefox can be launched with either root or given user uid&gid so that i don't need to parse the param --user <uid>:<gid> to my docker run command?
FROM debian:stretch
#==========
# Ruby 2.5.1
#==========
# cf. Dockerfile for ruby:2.3
# https://github.com/docker-library/ruby/blob/master/2.3/Dockerfile
# Install Ruby Dependencies
# cf. https://gorails.com/setup/ubuntu/16.04
RUN apt-get update \
&& rubyBuildDeps=' \
build-essential \
curl \
git-core \
libcurl4-openssl-dev \
libffi-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
libyaml-dev \
software-properties-common \
sqlite3 \
wget \
zlib1g-dev \
' \
&& apt-get install -y --no-install-recommends $rubyBuildDeps \
&& rm -rf /var/lib/apt/lists/*
# skip installing gem documentation
RUN mkdir -p /usr/local/etc \
&& { \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
ENV RUBY_MAJOR 2.5
ENV RUBY_VERSION 2.5.1
ENV RUBY_DOWNLOAD_SHA256 dac81822325b79c3ba9532b048c2123357d3310b2b40024202f360251d9829b1
ENV RUBYGEMS_VERSION 2.7.7
# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
RUN set -ex \
\
&& buildDeps=' \
bison \
libgdbm-dev \
ruby \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -rf /var/lib/apt/lists/* \
\
&& wget -O ruby.tar.gz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.gz" \
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
\
&& mkdir -p /usr/src/ruby \
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
&& rm ruby.tar.gz \
\
&& cd /usr/src/ruby \
\
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
# warning: Insecure world writable dir
&& { \
echo '#define ENABLE_PATH_CHECK 0'; \
echo; \
cat file.c; \
} > file.c.new \
&& mv file.c.new file.c \
\
&& ./configure --disable-install-doc \
&& make -j"$(nproc)" \
&& make install \
\
&& apt-get purge -y --auto-remove $buildDeps \
&& cd / \
&& rm -r /usr/src/ruby \
\
&& gem update --system "$RUBYGEMS_VERSION"
ENV BUNDLER_VERSION 2.0.1
RUN gem install bundler --version "$BUNDLER_VERSION" --force
# install things globally, for great justice
# and don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
ENV BUNDLE_PATH="$GEM_HOME" \
BUNDLE_BIN="$GEM_HOME/bin" \
BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
ENV PATH $GEM_HOME/bin:$BUNDLE_PATH/gems/bin:$PATH
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
&& chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
#===============
# Gecko Driver
#===============
ENV GECKODRIVER_VERSION 0.24.0
RUN apt-get update && \
apt-get install -y --no-install-recommends unzip && \
apt-get install -y --no-install-recommends \
bzip2 \
libgconf-2-4 \
libglib2.0-dev \
libnss3-dev \
libxi6 \
xvfb \
&& \
rm -rf /var/lib/apt/lists/* \
/var/cache/apt/* && \
wget https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz && \
tar -zxvf geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz && \
mv geckodriver /usr/local/bin/ && \
chmod +x /usr/local/bin/geckodriver && \
rm geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz && \
apt-get purge -y --auto-remove bzip2
#==========
# Firefox
#==========
ENV FF_LANG="en-US" \
FF_BASE_URL="https://archive.mozilla.org/pub" \
FF_PLATFORM="linux-x86_64" \
FF_INNER_PATH="firefox/releases" \
FF_VERSION="67.0"
ENV FF_COMP="firefox-${FF_VERSION}.tar.bz2"
ENV FF_URL="${FF_BASE_URL}/${FF_INNER_PATH}/${FF_VERSION}/${FF_PLATFORM}/${FF_LANG}/${FF_COMP}"
RUN apt-get update && \
apt-get install -y --no-install-recommends unzip && \
apt-get install -y --no-install-recommends \
bzip2 \
&& \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
wget "${FF_URL}" \
-O /tmp/firefox-linux.tar.bz2 && \
tar -xvf /tmp/firefox-linux.tar.bz2 -C /opt && \
ln -s /opt/firefox/firefox /usr/bin/firefox && \
chmod +x /usr/bin/firefox && \
rm /tmp/firefox-linux.tar.bz2 && \
apt-get purge -y --auto-remove bzip2
#---------------------------
# Dependencies for headless
#---------------------------
RUN apt-get update && \
headlessDeps=' \
imagemagick \
xvfb \
' && \
apt-get install -y --no-install-recommends $headlessDeps && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
#========================
# Font for Chinese
#========================
RUN apt-get update && \
apt-get install -y --no-install-recommends fonts-arphic-ukai fonts-arphic-uming && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
#==============================================
# On advice from:
# https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS /dev/null
#==============================================
# Jenkins Agent
#==============================================
# For the Amazon EC2 Container Service Plugin,
# we need the Docker image with an entryPoint which behaves as a
# Jenkins Agent.
# Instal OpenJDK-11
# cf. https://xmoexdev.com/wordpress/installing-openjdk-9-debian-stretch/
RUN echo deb http://http.debian.net/debian stretch-backports main >> /etc/apt/sources.list.d/stretch-backports.list && \
apt-get update && \
apt-get install -y --no-install-recommends -t stretch-backports openjdk-8-jdk && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
# Adapted from Docker Image: jenkins/slave
# https://hub.docker.com/r/jenkins/slave/~/dockerfile/
ARG user=jenkins
ARG group=jenkins
ARG uid=10000
ARG gid=10000
ENV HOME /home/${user}
RUN groupadd -g ${gid} ${group}
RUN useradd -c "Jenkins user" -d $HOME -u ${uid} -g ${gid} -m ${user}
ARG JENKINS_REMOTING_VERSION=3.20
ARG AGENT_WORKDIR=/home/${user}/agent
RUN curl --create-dirs -sSLo /usr/share/jenkins/slave.jar \
https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${JENKINS_REMOTING_VERSION}/remoting-${JENKINS_REMOTING_VERSION}.jar \
&& chmod 755 /usr/share/jenkins \
&& chmod 644 /usr/share/jenkins/slave.jar
# USER ${user}
ENV AGENT_WORKDIR=${AGENT_WORKDIR}
RUN mkdir /home/${user}/.jenkins && mkdir -p ${AGENT_WORKDIR}
VOLUME /home/${user}/.jenkins
VOLUME ${AGENT_WORKDIR}
# WORKDIR /home/${user}
# Docker Image: jenkins/jnlp-slave
# https://hub.docker.com/r/jenkinsci/jnlp-slave/~/dockerfile/
# uses the script from its git repository:
# https://github.com/jenkinsci/docker-jnlp-slave
# Docker builder can't copy files under 'config' directory,
# so keep jenkins-slave in top-level dir
COPY jenkins-slave /usr/local/bin/jenkins-slave
ENTRYPOINT ["jenkins-slave"]

Dockerfile not able to find ionic or cordova after install

I have a Dockerfile for which I'm trying to install ionic and cordova. The installation seems to work without error but I'm not able use them inside the container. The thing is, they are installed globally so I not sure what I'm missing. Any assistance is appreciated.
FROM openjdk:8
MAINTAINER me
# Install Git and dependencies
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y file git curl zip libncurses5:i386 libstdc++6:i386 zlib1g:i386 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists /var/cache/apt
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN mkdir -p /tmp/yarn && \
mkdir -p /opt/yarn/dist && \
cd /tmp/yarn && \
wget -q https://yarnpkg.com/latest.tar.gz && \
tar zvxf latest.tar.gz && \
find /tmp/yarn -maxdepth 2 -mindepth 2 -exec mv {} /opt/yarn/dist/ \; && \
rm -rf /tmp/yarn
RUN ln -sf /opt/yarn/dist/bin/yarn /usr/local/bin/yarn && \
ln -sf /opt/yarn/dist/bin/yarn /usr/local/bin/yarnpkg && \
yarn --version
RUN yarn global add ionic
RUN yarn global add cordova
# Set up environment variables
ENV ANDROID_HOME="/home/user/android-sdk-linux" \
SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip" \
GRADLE_URL="https://services.gradle.org/distributions/gradle-4.5.1-all.zip"
# Create a non-root user
RUN useradd -m user
USER user
WORKDIR /home/user
# Download Android SDK
RUN mkdir "$ANDROID_HOME" .android \
&& cd "$ANDROID_HOME" \
&& curl -o sdk.zip $SDK_URL \
&& unzip sdk.zip \
&& rm sdk.zip \
&& yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
# Install Gradle
RUN wget $GRADLE_URL -O gradle.zip \
&& unzip gradle.zip \
&& mv gradle-4.5.1 gradle \
&& rm gradle.zip \
&& mkdir .gradle
ENV PATH="/home/user/gradle/bin:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}"

How do i clean up / minimize the storage usage of my container from building opencv in dockerfile

Given my docker file
FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu14.04
RUN apt-get update
# disable interactive functions
ENV DEBIAN_FRONTEND noninteractive
#################Install MiniConda and other dependencies##########
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
ENV OPENBLAS_NUM_THREADS $(nproc)
RUN mkdir -p $CONDA_DIR && \
echo export PATH=$CONDA_DIR/bin:'$PATH' > /etc/profile.d/conda.sh && \
apt-get update -y && \
apt-get install -y \
wget \
git \
g++ \
graphviz \
software-properties-common \
python-software-properties \
python3-dev \
libhdf5-dev \
libopenblas-dev \
liblapack-dev \
libblas-dev \
libtbb2 \
libtbb-dev && \
apt-get -qq install -y \
build-essential \
unzip \
cmake \
pkg-config \
libjpeg8-dev \
libtiff4-dev \
libjasper-dev \
libpng12-dev \
libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
libatlas-base-dev \
gfortran && \
rm -rf /var/lib/apt/lists/* && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
/bin/bash /Miniconda3-latest-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
rm Miniconda3-latest-Linux-x86_64.sh
#########################MPI###########################
RUN cd /tmp && \
wget "https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.1.tar.gz" && \
tar xzf openmpi-2.1.1.tar.gz && \
cd openmpi-2.1.1 && \
./configure --with-cuda && make -j"$(nproc)" install # && ldconfig
#######################NCCL###########################
ENV CPATH /usr/local/cuda/include:/usr/local/include:$CPATH
RUN cd /usr/local && git clone https://github.com/NVIDIA/nccl.git && cd nccl && \
sed -i '/NVCC_GENCODE ?=/a \ -gencode=arch=compute_30,code=sm_30 \\' Makefile && \
make CUDA_HOME=/usr/local/cuda -j"$(nproc)" && \
make install && ldconfig
######### Compile for devices with cuda compute compatibility 3 (e.g. GRID K520 on aws) second line above
# UNCOMMENT line below to compile for GPUs with cuda compute compatibility 3.0
# sed -i '/NVCC_GENCODE ?=/a \ -gencode=arch=compute_30,code=sm_30 \\' Makefile && \
##########
###################Setup User##########################
ENV NB_USER chainer
ENV NB_UID 1000
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER -g sudo -p $(perl -e'print crypt("chainer", "aa")') && \
mkdir -p $CONDA_DIR && \
chown chainer $CONDA_DIR -R && \
mkdir -p /src && \
chown -R chainer /src
# mkdir -p /opencv && \
# chown -R chainer /opencv && \
# mkdir -p /opencv_contrib && \
# chown -R chainer /opencv_contrib
####################Python 3#########################
ARG python_version=3.5.2
RUN conda install -y python=${python_version} && \
pip install -U pip && \
conda install Pillow scikit-learn notebook pandas matplotlib mkl nose pyyaml six h5py && \
pip install numpy && \
pip install chainer && \
pip install chainercv && \
# pip install opencv-python && \
pip install pyyaml && \
conda clean -yt
# pip install -U pip && \
#
# conda install Pillow scikit-learn notebook pandas matplotlib mkl nose pyyaml six h5py && \
#
#
# pip install mpi4py && \
# pip install cython && \
#
# pip install chainer && \
# pip install chainercv && \
# pip install chainermn && \
ENV PYTHONPATH $CONDA_DIR/lib/python3.5/site-packages/:$PYTHONPATH
ENV PYTHONPATH /src/:$PYTHONPATH
WORKDIR /src
##OPENCV##
RUN wget https://github.com/Itseez/opencv/archive/3.3.0.zip -O opencv3.zip && \
unzip -q opencv3.zip && mv /src/opencv-3.3.0 /opencv && \
wget https://github.com/Itseez/opencv_contrib/archive/3.3.0.zip -O opencv_contrib3.zip && \
unzip -q opencv_contrib3.zip && mv /src/opencv_contrib-3.3.0 /opencv_contrib
RUN rm -r -f /opencv/build && mkdir /opencv/build && \
cd /opencv/build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_PYTHON_SUPPORT=ON \
-D CMAKE_INSTALL_PREFIX=$CONDA_DIR \
-D PYTHON3_LIBRARY=$CONDA_DIR/lib/python3.5 \
-D PYTHON3_INCLUDE_DIRS=$CONDA_DIR/include/python3.5m \
-D PYTHON3_EXECUTABLE=$CONDA_DIR/bin/python3 \
-D PYTHON3_PACKAGES_PATH=$CONDA_DIR/lib/python3.5/site-packages \
-D WITH_TBB=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
-D BUILD_EXAMPLES=OFF \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_IPP=OFF \
-D WITH_V4L=ON .. && \
make -j"$(nproc)" && \
make install && \
ldconfig
######################################################
USER chainer
It ends up at whooping 15GB in size.
What can I do to reduce the size in terms of all the selfbuild stuff happening? can some be deleted again?

Resources