Entering edit mode
4.3 years ago
MAPK
★
2.1k
I am trying to create a docker image from docker file and entrypoint. However, it only generates <none>:<none>
. This is my docker file and entrypoint.sh. Would someone please let me know what's missing here?
FROM openjdk:8-jre
LABEL maintainer="Maintainer <xxx@xxx.edu>"
LABEL org.label-schema.schema-version="1.0"
# LABEL org.label-schema.build-date=$BUILD_DATE
LABEL org.label-schema.name="testing/sratobam"
LABEL org.label-schema.description="Image for sratobam"
ENV SAMTOOLS_VERSION 1.9
ENV SRATOOL_VERSION 2.10.8
WORKDIR /tmp
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
wget \
libxml-libxml-perl \
make \
gcc \
g++ \
libz-dev \
libbz2-dev \
liblzma-dev \
ncurses-dev \
libnss-sss \
time \
&& wget -q https://github.com/lh3/bwa/releases/download/v${BWA_VERSION}/bwa-${BWA_VERSION}.tar.bz2 \
&& tar xjvf bwa-${BWA_VERSION}.tar.bz2 \
&& cd /tmp/bwa-${BWA_VERSION}/ \
&& make \
&& cp -av /tmp/bwa-${BWA_VERSION}/bwa /usr/bin/ \
&& 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/ \
&& cd /tmp \
&& wget -q http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/${SRATOOL_VERSION}/sratoolkit.${SRATOOL_VERSION}-ubuntu64.tar.gz \
&& tar -xvzf sratoolkit.${SRATOOL_VERSION}-ubuntu64.tar.gz \
&& cp /tmp/sratoolkit.${SRATOOL_VERSION}-ubuntu64/bin/sam-dump /usr/bin \
&& rm sratoolkit.${SRATOOL_VERSION}-ubuntu64.tar.gz \
&& ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime \
&& echo "America/Chicago" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& apt-get clean all
# Copy the local dbGAP key file into the container
COPY XXX_XXXX.ngc /usr/local/bin
# And import the key to allow dbGaP downloads
RUN vdb-config --import XXX_XXXX.ngc
COPY ./entrypoint.sh /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# CMD ["/bin/bash"]
entrypoint.sh
#!/bin/bash
VERSION="0.0.1"
# Entrypoint script for docker container testing/sratobam
GC_THREADS=2
CACHING=0
if [ -z "${THREADS}" ]; then THREADS=8; fi
DATE="/bin/date +%s"
display_date () {
/bin/date -d @${1} +%Y%m%d_%H%M%S
}
date_diff () {
earlier=${1}
later=${2}
diff=$((${later}-${earlier}))
if [ ${diff} -gt 86400 ]; then
date -u -d @$((${diff}-86400)) +"%jd%-Hh%-Mm%-Ss"
else
date -u -d @${diff} +"%-Hh%-Mm%-Ss"
fi
}
quit () {
echo "[$(display_date $(${DATE}))] Run failed at ${1} step, exit code: 1"
if [ "${SHELLDROP}" -eq 1 ]; then echo "Dropping to shell"; exec "/bin/bash"; else exit 1; fi
}
# trap "{ echo \"[$(display_date $(${DATE}))] Terminated by SIGTERM \"; quit \"${CUR_STEP}\"; }" SIGTERM
trap "echo \"[$(display_date $(${DATE}))] Terminated by SIGTERM \" && sleep 10s" SIGTERM
# Option for usage in docker
if [ "${SHELLDROP:=0}" -eq 1 ]; then echo "Dropping to shell"; exec "/bin/bash"; fi
# Mem
if [ -z "${MEM}" ]; then echo "WARNING, memory limit (in GB) not provided in variable \${MEM}; defaulting to 4G"; MEM=4; fi
# WORKDIR
if [ -z "${WORKDIR}" ]; then echo "WARNING, WORKDIR not provided in variable \${WORKDIR}"; fi
# SRAID
if [ -z "${SRAID}" ]; then echo "WARNING, SRAid not provided in variable \${SRAID}"; fi
if [ ! -z "${TIMING}" ]; then TIMING=(/usr/bin/time -v); fi
# Convert sra to bam
start=$(${DATE}); echo "[$(display_date ${start})] sratobam starting"
CUR_STEP="sratobam"
sam-dump ${SRAID} | samtools view -bS > "${WORKDIR}/${SRAID}.bam"
exitcode="$?"
end=$(${DATE}); echo "[$(display_date ${end})] SRA to BAM finished, exit code: ${exitcode}, step time $(date_diff ${start} ${end})"
exit ${exitcode}
Yes, I need to add dbGaP keys.
Just want to comment that I have had troubles in the past getting
sra-toolkit
installed and operating properly in a docker container. You may want to consider using the docker image provided by the developers at ncbi. See the wiki page here for instructions: https://github.com/ncbi/sra-tools/wiki/SRA-tools-docker