Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pubmlstget does not work with docker #180

Closed
thanhleviet opened this issue May 29, 2017 · 9 comments
Closed

pubmlstget does not work with docker #180

thanhleviet opened this issue May 29, 2017 · 9 comments

Comments

@thanhleviet
Copy link

thanhleviet commented May 29, 2017

When I run this command docker run --rm -it -v $(pwd):/data/ sangerpathogens/ariba ariba pubmlstget "Staphylococcus aureus" get_mlst
The get_mlst was expected to be in the current directory I run the command but it was not, event when I replaced $(pwd) with an absolute path, i.e. /home/ubuntu/mlst:/data but It did not work either.

BUT....
If I logged in docker container with docker run --rm -it -v $(pwd):/data/ sangerpathogens/ariba and run ariba pubmlstget "Staphylococcus aureus" get_mlst , it worked, and get_mlst appeared on the host

@martinghunt
Copy link
Collaborator

You need to do /data/get_mlst at the end, ie:

docker run --rm -it -v $(pwd):/data/ sangerpathogens/ariba ariba pubmlstget "Staphylococcus aureus" /data/get_mlst

@thanhleviet
Copy link
Author

Thank @martinghunt. It works now.
Did I ignore this instruction written somewhere in the wiki?

@martinghunt
Copy link
Collaborator

No you didn't, I should probably add example calls when using docker to the wiki...

@thanhleviet
Copy link
Author

thanhleviet commented May 30, 2017

@martinghunt Though your explanation made it worked but when I executed ariba run get_mlst/ref_db reads_1.fq reads_2.fq ariba_out with the fastq files correctly put in the $(pwd). I have found out that the docker image was not built in a proper way (my sense :)), and it's not quite safe to have root account owning the result folders. So I come up with my Dockerfile which some lines I copied some code from biocontainers

FROM sangerpathogens/ariba

RUN mkdir /data

#Code copied from biocontainers
RUN groupadd fuse &&
useradd --create-home --shell /bin/bash --user-group --uid 1000 --groups sudo,fuse biodocker &&
echo echo "biodocker\nbiodocker\n" | passwd biodocker &&
chown biodocker:biodocker /data

USER biodocker

VOLUME /data

CMD ["/bin/bash"]

WORKDIR /data

With this docker image, I can run smoothly the commands written on the wiki, such as:
docker run --rm -it -v $(pwd):/data/ thanhleviet/ariba ariba pubmlstget "Staphylococcus aureus" get_mlst

I will have a get_mlst folder inside the $(pwd)

docker run --rm -it -v $(pwd):/data/ thanhleviet/ariba ariba run get_mlst/ref_db reads_1.fq reads_2.fq ariba_out

And result folders have non-root permission.

@martinghunt
Copy link
Collaborator

martinghunt commented May 30, 2017

You could run this using the existing docker container:

docker run --rm -it -v $PWD:/data sangerpathogens/ariba ariba run /data/get_mlst/ref_db /data/reads_1.fq /data/reads_2.fq /data/ariba_out

ie /data is needed in front of the paths. The resulting ariba_out directory is not owned by root.

@thanhleviet
Copy link
Author

Understood! Thank you.
I ran the command:
docker run --rm -it -v $(pwd):/data sangerpathogens/ariba ariba run /data/mlst_get/ref_db /data/data/50_S14_L001_1P.fastq /data/data/50_S14_L001_2P.fastq /data/test1

It works but ....the folder is owned by root
drwxr-xr-x 2 root root 4.0K May 30 13:43 test1

@martinghunt
Copy link
Collaborator

That's interesting. When I run it (using a mac) I get this:
drwxr-xr-x 9 mhunt EBI\Domain Users 306B 30 May 13:55 ariba_out
Sorry, but I've no idea why the difference.

@thanhleviet
Copy link
Author

Those commands I ran on Ubuntu.
I have just replicated on my mac and the folders are not owned by root.
0 drwxr-xr-x 5 thanhlv staff 170B May 30 14:58 get_mlst/

I guess probably due to Mac uses virtual machine to run docker while Ubuntu uses docker directly. :)
Interesting! Anw, thanks for your help.

@martinghunt
Copy link
Collaborator

Thanks. I'll look into changing the docker so it works more easily on ubuntu as well. Thanks for the dockerfile fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants