Hi
I’m a new user to linux and docker.
My base OS is Linux Ubuntu 18.04.6 LTS.
I have a file that I want to analyse using Docker with various programs.
First I created a Dockerfile using ~$ sudo docker build -t nano_tools_debian
(the # comments are just for me giving myself some notes)
FROM debian
MAINTAINER <naqsdarwin>
RUN apt update && apt upgrade
#----------------------------------------------------------------------
# Below scripts are for initial setup of the container.
# In the case of pip, git, curl etc. remove the # from the install line
# for example if you need to run pip remove the # from <RUN apt-get -y
# install python3-pip>
#----------------------------------------------------------------------
RUN apt-get -y install python3-pip
RUN pip install nanofilt
RUN pip install NanoPlot
RUN pip install NanoPlot --upgrade
RUN apt-get -y install curl
RUN apt-get -y install git
RUN git clone https://github.com/lh3/minimap2
RUN cd minimap2 && make
RUN pip install pycoQC
#https://tleonardi.github.io/pycoQC/installation/
RUN git clone https://github.com/lh3/minimap2
RUN cd minimap2 && make
#----------------------------------------------------------------------
# The above completes the building of the container
# The below is now using the programs to analyse data
#----------------------------------------------------------------------
The command window showed that each RUN task completed successfully.
I’m able to view the docker image using ~$ sudo docker images
I can run the image using ~$ sudo docker run -it nano_tools_debian
the command window shows the below output
computername:~/nextflow/pipelines/docker_training/training_nanotools$ sudo docker run -it nano_tools_debian
root@555a72c61c4c:/#
I can use the debian bash to look around the file system.
Trying to follow these instructions from Dockerdocs:
START INSTRUCTIONS from Dockerdocs →
Mount volume (-v, --read-only)
$ docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu pwd
The -v
flag mounts the current working directory into the container. The -w
lets the command being executed inside the current working directory, by changing into the directory to the value returned by pwd
. So this combination executes the command using the container, but inside the current working directory.
$ docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash
When the host directory of a bind-mounted volume doesn’t exist, Docker will automatically create this directory on the host for you. In the example above, Docker will create the /doesnt/exist
folder before starting your container.
← END INSTRUCTIONS from Dockerdocs
I want to mount the dir with the file in it, to the nano_tools_debian image so the image can use the programs above to analyse the file. The results of the analysis from the various programs should be returned to the host OS when the image shuts down.
I’ve used variations of the command below to try and do this
sudo docker run --volume ~/nextflow/pipelines/docker_training/docker_training_b11_slp338_r16:/home/nano_tools_debian_slp338 --workdir ~/nextflow/pipelines/docker_training/docker_training_b11_slp338_r16 -u $(id -u):$(id -g) -it nano_tools_debian
When I do this I get the following error:
computername:~/nextflow/pipelines/docker_training/training_nanotools$ sudo docker run --volume ~/nextflow/pipelines/docker_training/docker_training_b11_slp338_r16:/home/nano_tools_debian_slp338 --workdir ~/nextflow/pipelines/docker_training/docker_training_b11_slp338_r16 -u $(id -u):$(id -g) -it nano_tools_debian
I have no name!@71fd18cac3ff:/home/shaun/nextflow/pipelines/docker_training/docker_training_b11_slp338_r16$ exit
exit
(note I will use the docker images in a nextflow.nf file, but first need to get the images working!)
I’ve been trouble shooting answers to this, from what I can gather, this error relates to user permissions and/or incorrect use of capital letters, spaces, underscores etc.
Out of interest this is the next Dockerfile with the first command that I want to run, I’ve commented out the RUN install commands as these should already be in nano_tools_debian and shouldn’t need to be run every time. But I can’t get to the Run NanoPlot command!
I realise there is a lot going on here, I’d appreciate any help!
FROM debian
MAINTAINER <naqsdarwin>
RUN apt update && apt upgrade
#----------------------------------------------------------------------
# Below scripts are for initial setup of the container.
# In the case of pip, git, curl etc. remove the # from the install line
# for exampl if you need to run pip remove the # from <RUN apt-get -y
# install python3-pip
#----------------------------------------------------------------------
#RUN apt-get -y install python3-pip
#RUN pip install nanofilt
#RUN pip install NanoPlot
#RUN pip install NanoPlot --upgrade
#RUN apt-get -y install curl
#RUN apt-get -y install git
#RUN git clone https://github.com/lh3/minimap2
#RUN cd minimap2 && make
#RUN pip install pycoQC
#https://tleonardi.github.io/pycoQC/installation/
#RUN git clone https://github.com/lh3/minimap2
#RUN cd minimap2 && make
#----------------------------------------------------------------------
# The above completes the building of the container
# The below is now using the programs to anaylse data
#----------------------------------------------------------------------
#--------------------------- -------------------------------------------
# Nanoplot
RUN NanoPlot --threads 16 --tsv_stats --summary ~/nextflow/pipelines/docker_training/docker_training_b11_slp338_R16/sequencing_summary.txt ---plots hex dot --N50 --title SLP338 --outdir ~/nextflow/pipelines/docker_training/docker_training_b11_slp338_R16/docker_nanoplot_output
#----------------------------------------------------------------------
# NanoFilt
#RUN cd ~/nextflow/pipelines/docker_training/docker_training_B11_SLP338_R16
#RUN gzip -c AIG*.fastq > docker_training.gz
#RUN gunzip -c docker_training.gz | NanoFilt --headcrop 30 --tailcrop 30
#----------------------------------------------------------------------
# Nanoplot again
# Minimap2