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

Using npm start in x11docker #45

Closed
jcalfee opened this issue May 23, 2018 · 3 comments
Closed

Using npm start in x11docker #45

jcalfee opened this issue May 23, 2018 · 3 comments
Labels

Comments

@jcalfee
Copy link

jcalfee commented May 23, 2018

npm start seems to loose its WORKDIR and think I'm in $HOME. I see this error:

x11docker: copy of environment stored in /x11docker/environment
x11docker: running image command: /tini -- npm start

  Last lines of command stderr:
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/fakehome/jcalfee/package.json'

It is odd that I can go into the container and run this command without x11docker and it works better:

root@2f5168a2b14d:/esteem-surfer# npm start

> [email protected] start /esteem-surfer
> node build/start.js

Is there a way I can look around? It would be helpful to run this container in x11docker but instead of using the npm start entrypoint I could run bash in "-i" interactive mode so I can look around?

For example:

# Creates error: Error: No such container: x11docker_X404_f8243a_esteem-surfer
x11docker $XDOCK --clipboard --homedir $HOME/.x11docker/esteem-surfer\
      -- "-i --entrypoint bash"\
       esteem-surfer

Regardless, is there something about the x11docker environment that I can tweak to get npm start working?

This is the Dockerfile I'm working with:

FROM ubuntu:bionic

RUN apt-get update &&\
    apt-get install -y --no-install-recommends\
    ca-certificates git nodejs npm

RUN git clone https://github.com/eSteemApp/esteem-surfer &&\
  cd esteem-surfer &&\
  git checkout tags/1.0.0 &&\
  npm install --no-optional &&\
  npm install -g bower

WORKDIR /esteem-surfer
RUN mv src/config.example.js src/config.js
RUN apt-get install -y libgtk2.0-0 libx11-xcb1 libxtst6 libxss1 libgconf-2-4 libnss3 libasound2

ENTRYPOINT [ "npm", "start" ]
@jcalfee
Copy link
Author

jcalfee commented May 23, 2018

Update .. the issue happen in node .. I tried a variation:

ENTRYPOINT [ "node", "build/start.js" ]

and got:

Error: Cannot find module '/home/jcalfee/build/start.js'

@mviereck
Copy link
Owner

mviereck commented May 23, 2018

npm start seems to loose its WORKDIR and think I'm in $HOME.

As default x11docker does cd $HOME.
I have made an update that regards WORKDIR in image. Use latest beta version with x11docker --update-master. x11docker will now cd to WORKDIR if specified in image.

Regardless, is there something about the x11docker environment that I can tweak to get npm start working?

You can specify working directory with --workdir /DIR. x11docker will cd to it instead of HOME.

Is there a way I can look around? It would be helpful to run this container in x11docker but instead of using the npm start entrypoint I could run bash in "-i" interactive mode so I can look around?

You can't directly run an interactive shell with x11docker. But you can get the container id to run docker exec.

read id < <(x11docker --showid imagename sleep infinity)
docker exec -ti $id bash

@jcalfee
Copy link
Author

jcalfee commented May 23, 2018

--update-master fixed this issue .. thanks

@jcalfee jcalfee closed this as completed May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants