Possibility to create wrapper plugin to run docker container?
We are using the Wrapper Plugin Creator to make a plugin for pangolin (https://github.com/cov-lineages/pangolin). Pangolin is available for linux/mac but we want to create a plugin that will run on Windows. We were thinking of using Docker to run it on Windows. My question is whether it is possible to run a Docker container with the Wrapper Plugin Creator or the Plugin Development Kit must be used?
I attempted:
docker run --rm -v /Users/userx/Geneious\ 2022.1\ Data/transient/1659433949158/x/:/mac \
covlineages/pangolin \
pangolin /mac/$1 --outfile /mac/$2
This gives an error message saying “docker: command not found”. (It works on the command line mounting a different folder on my computer.)
Is there any example available on how to run docker containers in plugins or do you have another suggestion how to run the application on Windows? We will probably run into similar cases in the future so some general advice would be great.
Error message:
/Users/userx/Geneious 2022.1 Data/WrapperPluginDevelopment/docker-pangolin/pangolinwrapper-docker.sh: line 5: docker: command not found Failed to run: /Users/userx/Geneious 2022.1 Data/WrapperPluginDevelopment/docker-pangolin/pangolinwrapper-docker.sh input.fasta dockerout, exit code: 127 docker-pangolin reported the following errors: /Users/userx/Geneious 2022.1 Data/WrapperPluginDevelopment/docker-pangolin/pangolinwrapper-docker.sh: line 5: docker: command not found docker-pangolin reported the following errors: /Users/userx/Geneious 2022.1 Data/WrapperPluginDevelopment/docker-pangolin/pangolinwrapper-docker.sh: line 5: docker: command not found
Technical details:
com.biomatters.geneious.publicapi.plugin.DocumentOperationException at com.biomatters.iseek.plugin.wrapperplugins.WrapperOperation.a(WrapperOperation.java:246) at com.biomatters.iseek.plugin.wrapperplugins.WrapperOperation.a(WrapperOperation.java:168) at com.biomatters.iseek.plugin.wrapperplugins.WrapperOperation.performOperation(WrapperOperation.java:130) at com.biomatters.geneious.publicapi.plugin.DocumentOperation.performOperation(DocumentOperation.java:453) at com.biomatters.geneious.publicapi.plugin.DocumentOperation.performOperation(DocumentOperation.java:399) at com.biomatters.iseek.plugin.operations.p.b(OperationManager.java:512) at com.biomatters.geneious.common.operations.c.c(OperationsUtilities.java:165) at com.biomatters.geneious.common.operations.c.b(OperationsUtilities.java:162) at com.biomatters.geneious.common.operations.b$c.a(OperationsUtilities.java:141) at com.biomatters.geneious.common.operations.b$d.a(OperationsUtilities.java:168) at com.biomatters.iseek.plugin.operations.e.a(OperationManager.java:517) at com.biomatters.iseek.plugin.operations.t.a(OperationPerformer.java:110) at com.biomatters.iseek.plugin.operations.OperationAction.performAction(OperationAction.java:116) at com.biomatters.iseek.plugin.operations.a.run(OperationAction.java:92) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: com.biomatters.geneious.publicapi.plugin.DocumentOperationException: /Users/userx/Geneious 2022.1 Data/WrapperPluginDevelopment/docker-pangolin/pangolinwrapper-docker.sh: line 5: docker: command not found Failed to run: /Users/userx/Geneious 2022.1 Data/WrapperPluginDevelopment/docker-pangolin/pangolinwrapper-docker.sh input.fasta dockerout, exit code: 127 docker-pangolin reported the following errors: /Users/userx/Geneious 2022.1 Data/WrapperPluginDevelopment/docker-pangolin/pangolinwrapper-docker.sh: line 5: docker: command not found at com.biomatters.iseek.plugin.wrapperplugins.WrapperOperation.a(WrapperOperation.java:514) at com.biomatters.iseek.plugin.wrapperplugins.WrapperOperation.a(WrapperOperation.java:218) at com.biomatters.iseek.plugin.wrapperplugins.WrapperOperation.a(WrapperOperation.java:179) at com.biomatters.iseek.plugin.wrapperplugins.WrapperOperation.a(WrapperOperation.java:152) ... 13 more
-
Hi Ida,
Unfortunately we haven't used the wrapper plugin much with docker. One user has had success in the past by writing a small script to run docker and then using the wrapper plugin creator to run their script. The error you're getting is that geneious can't find the docker executable. You may be able to fix this by specifying the exact path of the docker executable instead of just using "docker" (For example: "C:\Program Files\Docker\docker.exe run --rm ..."). Another idea might be to tick the box saying "Run using Windows Linux Subsystem" inside the wrapper plugin creator.
Finally, if all those fail, then the only solution I can think of would be to use the plugin development kit to write a plugin in java doing what you want. The Plugin Development Kit supports any java library, and there are various libraries or integrations you can find online to use docker from java code. (Such as this one https://github.com/docker-java/docker-java).
Hope that helps and let us know if you're still running into problems!
Tom
0 -
Hi Tom,
Many thanks for the suggestions! I should have thought of specifying the full path – that solved the error.
Now I am wondering about how to handle input/output. I get it to work if I can mount the right folder for example:
/path/to/Geneious\ 2022.1\ Data/transient/1659433949158/x/7/
However, it seems there is a new folder “1659433949158” with a new name every time Geneious is started, and the same for the folder “7” every time I run my plugin (or do other operations as well?). For now I have this solution:
SESSION=$(ls -v /path/to/Geneious\ 2022.1\ Data/transient/ | sort -n | tail -n 1)
FOLDER=$(ls -v /path/to/Geneious\ 2022.1\ Data/transient/$SESSION/x/ | sort -n | tail -n 1)
/path/to/docker run --rm -v /path/to/Geneious\ 2022.1\ Data/transient/$SESSION/x/$FOLDER:/geneious \
covlineages/pangolin \
pangolin /geneious/$1 --outfile /geneious/$2I guess I can add some checks for the folder names, but in general can I expect these two folders to be named with the largest number in their respective folder?
Kind regards,
Ida0 -
Hi Ida,
Awesome, glad to here that solved your problem. For specifying input files or folders, the wrapper plugin has some special options you can use in the command. One such option is [inputFolderName], when you run the command, this gets replaced with the folder path storing your documents. This should mean instead of using /path/to/Geneious\ 2022.1\ Data/transient/1659433949158/x/7/, you should be able to simply use [inputFolderName]. Have a look at the small question mark help in step 2 of the wrapper plugin creator for more details.
Cheers,
Tom0
Please sign in to leave a comment.
Comments
3 comments