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

How do you use this docker image #2

Closed
rocel opened this issue Jan 20, 2017 · 8 comments
Closed

How do you use this docker image #2

rocel opened this issue Jan 20, 2017 · 8 comments

Comments

@rocel
Copy link

rocel commented Jan 20, 2017

Hi,
I've tried something like :
docker run weboaks/node-karma-protractor-chrome npm test

but I get :

npm ERR! Linux 4.9.4-moby
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "test"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! path /package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log

Should I run the docker image in the root folder of my project and the entrypoint will execute any command I pass to it?

cheers.

@sylvaindumont
Copy link
Owner

Hi,

You need to mount your current folder into the image
docker run -v $(pwd):/home -w /home weboaks/node-karma-protractor-chrome npm test

You should run the image in the root folder of your project. The entrypoint will execute any command you pass to it.

@simondrabble
Copy link

What's the recommended way to install protractor into this image? And for my curiosity, why is it not included as part of the image itself?

Because the (default) user isn't root, I get this:

bash-4.4$ npm install -g protractor
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2018-09-17T19_03_21_595Z-debug.log

@sylvaindumont
Copy link
Owner

@simondrabble the recommended way is to add protractor to your devDependencies and install it alongside your project dependencies.
If you want to install protractor globally, you can use the debian-root or alpine-root tags.

@simondrabble
Copy link

That should work, thanks! It just seemed weird to me that this image doesn't have "batteries included" like I would expect.

@sylvaindumont
Copy link
Owner

Most of the time, protractor and karma are installed via depDependencies, and would be installed two times if they were already installed globally. Not including them is the image reduce the image size for these users.

@simondrabble
Copy link

Sounds reasonable. Thanks again!

@simondrabble
Copy link

One more qq: where/ how should webdriver be installed? I don't see a way to start it under protractor. You might want to consider adding some more "getting started/ using this image" documentation :)

@sylvaindumont
Copy link
Owner

On the debian based variants, just use webdriver installed by protractor. On the alpine based variants, this webdriver isn't compatible with musl, and we have to use one already installed in the image (in /usr/bin/chromedriver)

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