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

Problem running getpapers on Docker #87

Open
ShweataNHegde opened this issue Sep 16, 2020 · 6 comments
Open

Problem running getpapers on Docker #87

ShweataNHegde opened this issue Sep 16, 2020 · 6 comments

Comments

@ShweataNHegde
Copy link
Collaborator

ShweataNHegde commented Sep 16, 2020

Hello, I tried installing dockerised getpapers on my computer which runs Windows 10 Home OS. I was able to install docker, build an image of getpapers but I had trouble running it.
Here is all I did:

  • I made the following Dockerfile:
FROM node:slim
WORKDIR /usr/src/app
RUN npm install --global getpapers
  • Then built it into an image using this command

docker build -t paper_getter .

Here is what I got:

Sending build context to Docker daemon   2.56kB
Step 1/3 : FROM node:slim
 ---> 20b18b90ace4
Step 2/3 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 8fc47d76a46e
Step 3/3 : RUN npm install --global getpapers
 ---> Using cache
 ---> 9a77f9bef9d5
Successfully built 9a77f9bef9d5
Successfully tagged paper_getter:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories
  • I then tried running the image using the following command.
docker run -it \
 -v $(pwd)/results:/results \
 paper_getter \
 getpapers -p -x -o /results --query 'c4 photosynthesis flaveria'

For which I got,

-v : The term '-v' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:2 char:2
+  -v $(pwd)/results:/results \
+  ~~
    + CategoryInfo          : ObjectNotFound: (-v:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

paper_getter : The term 'paper_getter' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:3 char:2
+  paper_getter \
+  ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (paper_getter:String) [], CommandNotFoundE
   xception
    + FullyQualifiedErrorId : CommandNotFoundException

getpapers : The term 'getpapers' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:4 char:2
+  getpapers -p -x -o /results --query 'c4 photosynthesis flaveria'
+  ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (getpapers:String) [], CommandNotFoundExce
   ption
    + FullyQualifiedErrorId : CommandNotFoundException
  • But I quickly realized that the syntax must be different for Windows. Instead, I tried this:
    docker run -it paper_getter -v results:/results
    getpapers

For which I got the following error:

getpapers : The term 'getpapers' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ getpapers
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (getpapers:String) [], CommandNotFoundExce
   ption
    + FullyQualifiedErrorId : CommandNotFoundException
  • I'm completely new to Docker and I can't seem to figure out where I'm going wrong. Is it because I'm building a Docker image from Windows against a non-Windows Docker host? Or, am I running wrong commands?
@bauhuasbadguy
Copy link

bauhuasbadguy commented Sep 20, 2020

Can you try:-

docker run -it paper_getter -v results:/results \
getpapers -help

The first error looks like something about windows not liking the formatting of the docker run command. What is the version of docker you are using? It could be that they've changed the flag syntax at some point.

@ShweataNHegde
Copy link
Collaborator Author

I tried what you suggested:

PS C:\Users\shweata\Dockerfile> docker run -it paper_getter -v results:/results \
>> getpapers -help
v14.10.1
getpapers : The term 'getpapers' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:2 char:1
+ getpapers -help
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (getpapers:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I get the same error again.

This is the Docker Version installed on my computer:

Client: Docker Engine - Community
 Azure integration  0.1.15
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:43:18 2020
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:49:27 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

@bauhuasbadguy
Copy link

Can you try jamming everything onto one line? It looks like its having trouble with the linebreak. So:

docker run -it paper_getter getpapers --help

I've removed the volume mount until we get to the bottom of this

@tarrow
Copy link

tarrow commented Sep 21, 2020 via email

@ShweataNHegde
Copy link
Collaborator Author

  • So I ran the following command:

docker run -it paper_getter getpapers -q viral epidemic -k 10 -o C:\users\shweata\viralepidemicstest1 -p
And this is what I got:

C:\Users\shweata>docker run -it paper_getter getpapers -q viral epidemic  -k 10 -o C:\users\shweata\viralepidemicstest1 -p
info: Searching using eupmc API
(node:1) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
info: Found 315639 open access results
warn: This version of getpapers wasn't built with this version of the EuPMC api in mind
warn: getpapers EuPMCVersion: 5.3.2 vs. 6.4 reported by api
info: Limiting to 10 hits
Retrieving results [==============================] 100% (eta 0.0s)
info: Done collecting results
info: limiting hits
info: Saving result metadata
info: Full EUPMC result metadata written to eupmc_results.json
info: Individual EUPMC result metadata records written
info: Extracting fulltext HTML URL list (may not be available for all articles)
info: Fulltext HTML URL list written to eupmc_fulltext_html_urls.txt
info: Downloading fulltext PDF files
Downloading files [==============================] 100% (10/10) [0.0s elapsed, eta 0.0]
info: All downloads succeeded!

C:\Users\shweata>cd viralepidemictest1
The system cannot find the path specified.

I was able to run it but no output directory was created.

  • I also tried this to see what happens:docker run -it paper_getter -v results:/results ^

getpapers -help

C:\Users\shweata>docker run -it paper_getter -v results:/results ^
More? getpapers -help
v14.10.1

So, the problem might be with mounting volumes in Windows.

@bauhuasbadguy
Copy link

In this command

docker run -it paper_getter getpapers -q viral epidemic -k 10 -o C:\users\shweata\viralepidemicstest1 -p

You are trying to use a location that exists on your windows machine that does not exist inside the docker container. When the -v flag is used it connects a folder on your local machine to a folder inside the docker container. The container will be using a unix file system so will start with a / so there won't be a C drive inside the container.

If you want to have a look inside the container you could run

docker run -it paper_getter bash

Which will make it look like you are remote sshing into a virtual machine

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

3 participants