FATAL tini (7) exec /docker-entrypoint.sh failed: No such file or directory - linux

I'm getting this error when I run my Dockerfile.
[FATAL tini (7)] exec /docker-entrypoint.sh failed: No such file or directory
The docker build command runs fine but when I try to run it I get this issue.
I have confirmed that docker-entrypoint.sh file does exist in the root via linux find -name "docker-entrypoint.sh".
It's not a permissions issue since I have set the full read/write permissions for the file via chmod 777 command.
Any idea what I'm missing here. Below is a snippet from my Dockerfile
ARG base_image_name=tomcat
ARG base_image_version=9-jdk11-openjdk-slim
FROM $base_image_name:$base_image_version
ARG component_exe
COPY docker-entrypoint.sh $component_exe /
ENV APP_ROOT=/usr/local/tomcat
ENV component_runtime=${APP_ROOT}/webapps/$component_exe
ENV APP_USER=uat
# Install all required packages and set appropriate access permissions
RUN \
apt-get -y update && \
apt-get -y upgrade && \
apt-get install jq bash ca-certificates tini && \
adduser --disabled-password --gecos "" ${APP_USER} && \
mkdir -p ${APP_ROOT}/temp && \
mkdir -p ${APP_ROOT}/bin && \
mkdir -p ${APP_ROOT}/webapps && \
chmod 777 ${APP_ROOT}/webapps && \
chown -R ${APP_USER}:root ${APP_ROOT} && \
chmod 777 /docker-entrypoint.sh && \
chmod -R g=u ${APP_ROOT} && \
find / -name *.war && \
find / -name *tini* && \
find / -name *-entrypoint.sh && \
mv /$component_exe /usr/local/tomcat/webapps && \
chown -R :root /usr/local/openjdk-11/lib/security/cacerts && \
chmod 660 /usr/local/openjdk-11/lib/security/cacerts
EXPOSE 8080/tcp
ENTRYPOINT ["/usr/bin/tini", "--", "/docker-entrypoint.sh"]
# Start Tomcat Server.
CMD ["catalina.sh", "run"]

Related

How to include shell script suite in docker file

I am trying to create a docker image for BBMAP (https://sourceforge.net/projects/bbmap/files/latest/download) shell script suite available online along with samtools and picard.jar. I was able to run samtools and picard, but for some reason I am not able to add bbmap below. Can someone please let me know what I am missing here?
I am trying to add shell scripts to bin to run them as executables.
In my docker file below, this is where I need help:
&& wget -q https://sourceforge.net/projects/bbmap/files/latest/download \
&& tar -xjvf /tmp/download \
&& cp -av /tmp/bbmap/* /usr/bin/ \
Dockerfile:
FROM openjdk:8-jre
LABEL maintainer="AN <XXX#wustl.edu>"
LABEL org.label-schema.schema-version="1.0"
# LABEL org.label-schema.build-date=$BUILD_DATE
LABEL org.label-schema.name="an/samtofastq"
LABEL org.label-schema.description="Image for Reverting .bam"
ENV SAMTOOLS_VERSION 1.9
ENV PICARD_VERSION 2.20.8
WORKDIR /tmp
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
make \
gcc \
g++ \
libz-dev \
libbz2-dev \
liblzma-dev \
ncurses-dev \
bc \
libnss-sss \
time \
&& cd /tmp \
&& wget -q https://github.com/samtools/samtools/releases/download/${SAMTOOLS_VERSION}/samtools-${SAMTOOLS_VERSION}.tar.bz2 \
&& tar xjvf samtools-${SAMTOOLS_VERSION}.tar.bz2 \
&& cd /tmp/samtools-${SAMTOOLS_VERSION}/ \
&& make \
&& cp -av /tmp/samtools-${SAMTOOLS_VERSION}/samtools /usr/bin/ \
&& wget -q -O /usr/bin/picard.jar https://github.com/broadinstitute/picard/releases/download/${PICARD_VERSION}/picard.jar \
&& wget -q https://sourceforge.net/projects/bbmap/files/latest/download \
&& tar -xjvf /tmp/download \
&& cp -av /tmp/bbmap/* /usr/bin/ \
&& ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime \
&& echo "America/Chicago" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& apt-get clean all \
&& rm -rfv /var/lib/apt/lists/* /tmp/* /var/tmp/*
# COPY ./entrypoint.sh /usr/local/bin/
ENV PICARD /usr/bin/picard.jar
## Add ENV for Shell scripts from BBMAP
# ENV DEMUX /usr/bin/demuxbyname.sh
# ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/bin/bash"]
This is the error I am getting:
tar (child): /tmp/download: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Earlier in your script, you run:
cd /tmp/samtools-${SAMTOOLS_VERSION}/
So when you run this:
wget -q https://sourceforge.net/projects/bbmap/files/latest/download
The resulting file is:
/tmp/samtools-${SAMTOOLS_VERSION}/download
That means that when you run your tar command:
tar -xjvf /tmp/download
...it doesn't find the file because it isn't in /tmp.
Either change the path on the tar command, or add a cd /tmp to your script before downloading the file. Or pass something like -O /tmp/download.tar to your wget invocation.

How to include chromedriver in gitlab CI/CD?

I have a python selenium script that needs to be run in GitLab CI/CD. Script is running perfectly in local but the only issue is of chrome driver path in gitlab.
Do I also need to add the script to download the chrome?
I am new to gitlab CI/CD.Need help!!
Thanks
Create a Dockerfile which install all the browsers and their web drivers. Create that image and call that image in gitlab to run your tests. Here is the sample dockerfile.
FROM ubuntu:bionic
RUN apt-get update && apt-get install -y \
python3 python3-pip \
fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
libnspr4 libnss3 lsb-release xdg-utils libxss1 libdbus-glib-1-2 \
curl unzip wget \
xvfb
# install geckodriver and firefox
RUN GECKODRIVER_VERSION=`curl https://github.com/mozilla/geckodriver/releases/latest | grep -Po 'v[0-9]+.[0-9]+.[0-9]+'` && \
wget https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz && \
tar -zxf geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz -C /usr/local/bin && \
chmod +x /usr/local/bin/geckodriver && \
rm geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz
RUN FIREFOX_SETUP=firefox-setup.tar.bz2 && \
apt-get purge firefox && \
wget -O $FIREFOX_SETUP "https://download.mozilla.org/?product=firefox-latest&os=linux64" && \
tar xjf $FIREFOX_SETUP -C /opt/ && \
ln -s /opt/firefox/firefox /usr/bin/firefox && \
rm $FIREFOX_SETUP
# install chromedriver and google-chrome
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
wget https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
unzip chromedriver_linux64.zip -d /usr/bin && \
chmod +x /usr/bin/chromedriver && \
rm chromedriver_linux64.zip
RUN CHROME_SETUP=google-chrome.deb && \
wget -O $CHROME_SETUP "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && \
dpkg -i $CHROME_SETUP && \
apt-get install -y -f && \
rm $CHROME_SETUP
# install phantomjs
RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
tar -jxf phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs && \
rm phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN pip3 install selenium
RUN pip3 install pyvirtualdisplay
RUN pip3 install Selenium-Screenshot
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV APP_HOME /usr/src/app
WORKDIR /$APP_HOME
COPY . $APP_HOME/
CMD tail -f /dev/null
CMD python3 example.py

./asinstall not found in while docker build using dockerfile?

I am trying to build docker image using docker file . The docker file will contain aerospike database creation.
RUN wget -O aerospike.tgz 'https://www.aerospike.com/download/server/latest/artifact/ubuntu18'
RUN tar -xvf aerospike.tgz
RUN cd aerospike-server-community-*-ubuntu18*
RUN ./asinstall
FROM ubuntu:18.04
RUN apt-get update && apt-get install -q -y curl python2.7 python
RUN TEMPDIR=$(mktemp -d) && \
cd $TEMPDIR && \
curl -L 'https://www.aerospike.com/download/server/latest/artifact/ubuntu18' | tar xzv --strip-components 1 && \
./asinstall && \
cd / && \
rm -rf $TEMPDIR
seems to work.

build image from tarball

I create a tar archive from within my working dir
tar -chv . --exclude='build/tarball.tar' > build/tarball.tar
and would like to create an image from this
sudo docker build - < build/tarball.tar
This is my dockerfile
FROM node:8.11.3-slim
RUN apt-get update && apt-get install -y
ENV GOSU_VERSION 1.10
RUN set -x \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
# node-user comes from node-docker-image
RUN chown -R node:node /usr/src/app
EXPOSE 8080
ENV NODE_ENV production
CMD ["gosu","node","npm","start"]
However starting the images failes because node throws an error:
Error: Cannot find module '..'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
If I create the image from the directory itself it works, why doesn't it work if I point to the tar archive?
Depending on your docker version, I think you might want to be using docker import:
docker import build/tarball.tar mynode:latest

How to speed up running docker-container with node.js?

I develop application with node.js and docker. My deploy process includes few steps:
build docker-image
run docker-container
I have 19 seconds to running of my node_js container. But i want to reduce the time to 1-5 seconds at least.
Most of run container time it takes npm install.
It is possible to speed up running my node.js application?
Dockerfile
FROM ubuntu:14.04
MAINTAINER Vovan
# docker build --build-arg NODE_VERSION=any_version .
ARG NODE_VERSION=4.4.2
ARG EXTERNAL_GIT_URI=local_gitlab
ARG EXTERNAL_GIT_PORT=22
# variables
ENV TERM=xterm
# use bash instead of sh
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# essential system updates and soft
RUN apt-get update -qq \
&& apt-get install -yq \
ntp \
build-essential \
curl \
mc \
nano \
git \
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash \
# add nvm as term command
&& . ~/.nvm/nvm.sh \
#
&& nvm install ${NODE_VERSION} \
&& nvm alias default ${NODE_VERSION}
# home directory
RUN useradd -m -d /home/app -s /bin/bash app -u9999
# copy keys in image
ADD for_gitlab /root/.ssh/for_gitlab
ADD config /root/.ssh/config
RUN chmod 600 /root/.ssh/* \
&& ssh-keyscan -p ${EXTERNAL_GIT_PORT} ${EXTERNAL_GIT_URI} > /root/.ssh/known_hosts
# copy script and make it executable
WORKDIR /
RUN mkdir config
ADD starter.sh /config
CMD ["/config/starter.sh"]
RUN chmod +x /config/starter.sh
WORKDIR /home/app
starter.sh
APP_DIR=/home/app/${GIT_REPO_NAME}
GIT_CLONE_URI=git#local_gitlab:${GIT_GROUP}/${GIT_REPO_NAME}.git
cd /home/app
git clone ${GIT_CLONE_URI} --depth 1 --branch ${GIT_REPO_BRANCH}
# permissions
find ${APP_DIR} -type f -exec chmod 644 {} \;
find ${APP_DIR} -type d -exec chmod 755 {} \;
chown -R app:app ${APP_DIR}
#
. ~/.nvm/nvm.sh
nvm use default
cd ${APP_DIR} && npm install
find ${APP_DIR}/node_modules -type f -exec chmod 644 {} \;
find ${APP_DIR}/node_modules -type d -exec chmod 755 {} \;
node ${SCRIPT}
You can conditinally run npm install by checking if package.json has been modified since the last the installation. Here I'm checking if package.json modified time is newer than node_modules modified time :
[ package.json -nt node_modules ] && npm install ;

Resources