Created
October 21, 2016 06:08
-
-
Save mictadlo/71d404441f3fc628bf851650c07f4a90 to your computer and use it in GitHub Desktop.
command not found inside Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add local user | |
# Either use the LOCAL_USER_ID if passed in at runtime or | |
# fallback | |
USER_ID=${LOCAL_USER_ID:-9001} | |
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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (https://sourceforge.net/projects/bowtie-bio) | |
ENV BOWTIE_VAR 1.1.2 | |
COPY bowtie-${BOWTIE_VAR}-linux-x86_64.zip /tmp/ | |
RUN unzip /tmp/bowtie-${BOWTIE_VAR}-linux-x86_64.zip -d /usr/local/ && \ | |
rm /tmp/bowtie-${BOWTIE_VAR}-linux-x86_64.zip && \ | |
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 | |
ENV SAMTOOLS_VER 0.1.19 | |
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 (https://denibertovic.com/posts/handling-permissions-with-docker-volumes/) | |
VOLUME ["/export/", "/data/", "/var/lib/docker"] | |
RUN apt-get update && apt-get -y --no-install-recommends install \ | |
ca-certificates \ | |
curl | |
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 | |
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.4/gosu-$(dpkg --print-architecture)" \ | |
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.4/gosu-$(dpkg --print-architecture).asc" \ | |
&& gpg --verify /usr/local/bin/gosu.asc \ | |
&& rm /usr/local/bin/gosu.asc \ | |
&& chmod +x /usr/local/bin/gosu | |
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | |
RUN chmod +x /usr/local/bin/entrypoint.sh | |
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | |
#USER ubuntu | |
# Mark folders as imported from the host. | |
# VOLUME ["/export/", "/data/", "/var/lib/docker"] | |
#ENTRYPOINT ["python3", "/BUSCO_v1.1b1/BUSCO_v1.1b1.py"] | |
#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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM samtools | |
CMD ["/bin/bash"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment