I am running below contents in dockerfile it runs until yum installation and fails as, /bin/sh: RUN: command not found
DockerFile:
FROM amazonlinux:latest
ADD . /tmp/
RUN yum install gzip -y && \
yum install tar -y && \
yum install libstdc++.so.6 -y && \
RUN cd /tmp && /usr/bin/gunzip TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && /usr/bin/tar -xvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar
RUN cd /tmp/TeradataToolsAndUtilitiesBase/ && ./setup.bat a
CMD ["/bin/bash"]
Error:
Installed:
libstdc++.i686 0:7.3.1-5.amzn2.0.2
Dependency Installed:
glibc.i686 0:2.26-32.amzn2.0.1 libgcc.i686 0:7.3.1-5.amzn2.0.2
Complete!
/bin/sh: RUN: command not found
The command '/bin/sh -c yum install gzip -y && yum install tar -y && yum install libstdc++.so.6 -y && RUN cd /tmp && /usr/bin/gunzip TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && /usr/bin/tar -xvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar' returned a non-zero code: 127
system:ttudockerimg$
Please help.
Just use one RUN command, and escape newlines. If you have several commands, you have to wrap them in a bash command.
Besides that, you can extract from a .tar.gz file directly without uncompressing it first.
FROM amazonlinux:latest
ADD . /tmp/
RUN yum install gzip -y && \
yum install tar -y && \
yum install libstdc++.so.6 -y && \
/bin/bash -c 'cd /tmp && \
/usr/bin/tar -xzvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && \
cd /tmp/TeradataToolsAndUtilitiesBase/ && \
./setup.bat a
CMD ["/bin/bash"]
Related
I am encountering an issue with my Dockerfile. Previously, it was working fine, but now it is throwing an error that reads "cannot connect to chrome at 127.0.0.1:53190 This version of ChromeDriver only supports Chrome version 110 Current browser version is 109.0.5414.119". I am unsure how to resolve this issue. Here is the code for my Dockerfile:
FROM python:3.9
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
mkdir -p /opt/chromedriver-$CHROMEDRIVER_VERSION && \
curl -sS -o /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-$CHROMEDRIVER_VERSION && \
rm /tmp/chromedriver_linux64.zip && \
chmod +x /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver && \
ln -fs /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver /usr/local/bin/chromedriver
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list && \
apt-get -yqq update && \
apt-get -yqq install google-chrome-stable && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY ./requirements.txt .
COPY ./ .
RUN python -m pip install --upgrade pip
RUN pip install -r requirements.txt
CMD ["python","main.py"]
i am not an expert in docker,
i am a python developer,
also above dockerfile is not written by me,
i am clueless what to do
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.
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
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.
I have the following Dockerfile:
FROM alpine:3.3
RUN apk update \
&& apk add curl tar git gzip
RUN curl --retry 3 --retry-delay 20 --show-error --location --remote-name --silent "https://nodejs.org/dist/v6.2.0/node-v6.2.0-linux-x64.tar.gz" \
&& tar -xzf "node-v6.2.0-linux-x64.tar.gz" -C /usr/local --strip-components=1 --same-owner \
&& rm -rf "node-v6.2.0-linux-x64.tar.gz" \
&& ls -la /usr/local/bin && env \
&& /usr/local/bin/node -v \
&& npm cache clear
Building the image gives me:
Sending build context to Docker daemon 13.51 MB
Step 1 : FROM alpine:3.3
---> 3e467a6273a3
Step 2 : RUN apk update && apk add curl tar git gzip # bzip2 build-essential libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev python python-dev python-pip python-virtualenv libkrb5-devENV NODE_VERSION=6.2.0
---> Using cache
---> 65f46657024a
Step 3 : RUN curl --retry 3 --retry-delay 20 --show-error --location --remote-name --silent "https://nodejs.org/dist/v6.2.0/node-v6.2.0-linux-x64.tar.gz" && tar -xzf "node-v6.2.0-linux-x64.tar.gz" -C /usr/local --strip-components=1 --same-owner && rm -rf "node-v6.2.0-linux-x64.tar.gz" && ls -la /usr/local/bin && env && /usr/local/bin/node -v && npm cache clear
---> Running in 32967b91e2dd
total 26828
drwxrwxr-x 2 500 500 4096 May 17 19:40 .
drwxr-xr-x 10 root root 4096 May 24 14:28 ..
-rwxrwxr-x 1 500 500 27459658 May 17 19:40 node
lrwxrwxrwx 1 500 500 38 May 17 19:40 npm -> ../lib/node_modules/npm/bin/npm-cli.js
HOSTNAME=27c9668b3d5e
SHLVL=1
HOME=/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
/bin/sh: /usr/local/bin/node: not found
The command '/bin/sh -c curl --retry 3 --retry-delay 20 --show-error --location --remote-name --silent "https://nodejs.org/dist/v6.2.0/node-v6.2.0-linux-x64.tar.gz" && tar -xzf "node-v6.2.0-linux-x64.tar.gz" -C /usr/local --strip-components=1 --same-owner && rm -rf "node-v6.2.0-linux-x64.tar.gz" && ls -la /usr/local/bin && env && /usr/local/bin/node -v && npm cache clear' returned a non-zero code: 127
Build image failed
How is it possible for node to not be found?
It's installed in the correct directory, it's in the path, and has execution permission...
There is an official and up to date node package for alpine, you don't need to install it manually, just add this line in your Dockerfile:
RUN apk add nodejs=6.2.0-r0
Or you could use an existing nodejs alpine image:
FROM mhart/alpine-node:6.2.0
On a side note, the whole point of using an alpine based image is to get rid of the clutter, installing git, tar et al. is a waste of space IMHO.