Skip to content

Instantly share code, notes, and snippets.



Created Oct 21, 2016
What would you like to do?
command not found inside Docker
# Add local user
# Either use the LOCAL_USER_ID if passed in at runtime or
# fallback
echo "Starting with UID : $USER_ID"
useradd --shell /bin/bash -u $USER_ID -o -c "" -m user
export HOME=/home/user
exec /usr/local/bin/gosu user "$@"
# Howto
cd samtools
docker build -t samtools .
cd ../samtools-run
docker build -t samtools-run .
docker run -it -e LOCAL_USER_ID=`id -u $USER` samtools-run
user@d2a1d8faa190:/usr/local/samtools-0.1.19$ samtools
bash: samtools: command not found
FROM ubuntu:16.04
# Setup OS
RUN apt-get update -y && apt-get upgrade -y
#RUN apt-get -y install python-software-properties
RUN apt-get -y install software-properties-common
#RUN add-apt-repository ppa:nebc/bio-linux
#RUN add-apt-repository ppa:openjdk-r/ppa
RUN apt-get update -y
RUN apt-get install -y wget curl unzip git parallel openjdk-8-jre python-pip python-dev build-essential gfortran zlib1g-dev
# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
# Bowtie (
COPY bowtie-${BOWTIE_VAR} /tmp/
RUN unzip /tmp/bowtie-${BOWTIE_VAR} -d /usr/local/ && \
rm /tmp/bowtie-${BOWTIE_VAR} && \
find /usr/local/bowtie-${BOWTIE_VAR} -type f -executable -exec ln -s {} /usr/local/bin \; && \
find /usr/local/bowtie-${BOWTIE_VAR}/scripts -type f -executable -exec ln -s {} /usr/local/bin \;
# Samtools
ADD samtools-${SAMTOOLS_VER}.tar.bz2 /usr/local/
RUN apt-get install libncurses5-dev -y
WORKDIR /usr/local/samtools-${SAMTOOLS_VER}
RUN make
RUN chown -R 1000 /usr/local/samtools-${SAMTOOLS_VER}
RUN chmod -R a+rX /usr/local/samtools-${SAMTOOLS_VER}
RUN find /usr/local/samtools-${SAMTOOLS_VER} -type f -executable -exec ln -s {} /usr/local/bin \; && \
find /usr/local/samtools-${SAMTOOLS_VER}/misc -type f -executable -exec ln -s {} /usr/local/bin \; && \
find /usr/local/samtools-${SAMTOOLS_VER}/bcftools -type f -executable -exec ln -s {} /usr/local/bin \;
# Created files have not root owner (
VOLUME ["/export/", "/data/", "/var/lib/docker"]
RUN apt-get update && apt-get -y --no-install-recommends install \
ca-certificates \
RUN gpg --keyserver --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
RUN curl -o /usr/local/bin/gosu -SL "$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -SL "$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu
COPY /usr/local/bin/
RUN chmod +x /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/"]
#USER ubuntu
# Mark folders as imported from the host.
# VOLUME ["/export/", "/data/", "/var/lib/docker"]
#ENTRYPOINT ["python3", "/BUSCO_v1.1b1/"]
#ENTRYPOINT ["/bin/bash"]
# Cleanup
#RUN DEBIAN_FRONTEND=noninteractive apt-get purge -y build-essential
#RUN DEBIAN_FRONTEND=noninteractive apt-get purge -y gfortran
#RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Include all needed scripts and libraries from the host
# compressed archives will be extracted automatically
# ADD ./snakefile /galaxy-central/
# Execute the pipeline
FROM samtools
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment