Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xvfb-run hangs in container

Tags:

docker

xvfb

I'm trying to containerize a Node application that creates snapshots of .STL files. This application is started through xvfb-run to provide it a mock GUI in which it can generate said snapshots, and it works if I just run the application without a container, but when I try to containerize it, xvfb-run simply hangs. Nothing is printed in the container console, there are no logs, and adding -e /dev/stdout to xvfb-run doesn't output anything.

This is my dockerfile:

FROM debian:latest AS build-env
WORKDIR /app
COPY src ./src
COPY tsconfig.json ./
COPY package.json ./
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -my wget gnupg
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install -y nodejs build-essential libxi-dev xvfb libgl1-mesa-dev libglu1-mesa-dev libglew-dev
RUN npm install .
RUN npm install -g typescript
RUN tsc
EXPOSE 3000
CMD ["xvfb-run", "node", "dist/examples/server.js"]

Example run (the cursor hangs there forever, nothing is ever printed)

example run

Edit: Just wanted to clarify that it IS supposed to print something - the Express server prints something when it starts, so I can tell it's not starting and something is wrong. I can also confirm that the xvfb-run command is present, as running it without any other arguments displays a help message.

like image 284
Artem Zakharov Avatar asked Jun 01 '18 01:06

Artem Zakharov


1 Answers

maybe late, but just saw your post. You probably need something like tini, so use --init flag when you do docker run. This will load init system as the ENTRYPOINT

Wine is a good example about how to use it

And to use it in docker-compose, just add init: true (inside the service).

I also found something similar, maybe it's useful for you too: stl-thumb

Hope it helps!

like image 152
Abel Paz Avatar answered Oct 08 '22 15:10

Abel Paz