Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Launching specs with docker-compose #1019

Closed
RemyMaucourt opened this issue Aug 8, 2017 · 8 comments
Closed

Launching specs with docker-compose #1019

RemyMaucourt opened this issue Aug 8, 2017 · 8 comments

Comments

@RemyMaucourt
Copy link

RemyMaucourt commented Aug 8, 2017

I can't launch rspec with docker-compose since I installed capybara-webkit.

This next command just hold up for hours, doing nothing:

$ docker-compose run web xvfb-run -a bundle exec rspec

Running it with the --verbose option don't give much more information.

It's working if I launch a bash terminal in my container and fire the command from there. $ docker-compose run web bash then $ xvfb-run -a bundle exec rspec spec launch the specs correctly.

Is there a special config for docker-compose I should be aware of?

The Dockerfile:

FROM ruby:2.4.1

RUN apt-get update -qq && apt-get install -y \
  build-essential \
  libpq-dev \
  nodejs \
  xvfb \
  qt5-default \
  libqt5webkit5-dev \
  gstreamer1.0-plugins-base \
  gstreamer1.0-tools \
  gstreamer1.0-x

RUN mkdir /app_dir
WORKDIR /app_dir

ADD Gemfile* /app_dir/

RUN bundle install

COPY . .

I give more details on this Stackoverflow post

@ryansch
Copy link

ryansch commented Aug 8, 2017

I didn't have much luck with xvfb-run so I just put the following into my entrypoint:

    echo 'Starting Xvfb'
    Xvfb :99 -screen 0 1280x1024x24 &
    export DISPLAY=:99

(This only runs when we're running rspec or set an env var.)

@jferris
Copy link
Member

jferris commented Aug 8, 2017

Could you run something else within xvfb-run to figure out if it's something capybara-webkit is doing? For example: docker-compose run web xvfb-run -a bash

@RemyMaucourt
Copy link
Author

Well, it seems to be a docker-compose / xvfb problem: docker-compose run web xvfb-run -a bash is staying on hold too.

@jferris
Copy link
Member

jferris commented Aug 9, 2017

I'm going to close this issue, as it doesn't seem like a bug in capybara-webkit, but feel free to continue commenting.

If you wrap the xvfb-run invocation in a shell, does that have any effect?

docker-compose run bash -c 'xvfb-run -a rspec'

I don't know what's causing the hang, but my best guesses are something to do with 1) the default shell 2) stdin 3) interactive vs non-interactive shell invocations.

@jferris jferris closed this as completed Aug 9, 2017
@RemyMaucourt
Copy link
Author

Thank you for the courtesy and the reactivity.

docker-compose run web bash -c 'xvfb-run -a rspec' stays on hold too.

I like the 'non-interactive shell' lead, I keep investigating and will keep you informed.

@asafigan
Copy link

I'm having the exact same problem. If you find a fix or any more information could you pass it on?

@RemyMaucourt
Copy link
Author

I endend up writing another Stackoverflow post

@jamescontent
Copy link

I realize this is an old post, but in case anyone comes across it you should check out the work that Mark Adams did with this handy script. With this script (also take a look at how he uses it in the dockerfiles in that same repo), I'm at least able to run docker-compose run web xvfb-run rspec correctly and it functions as expected. I'm still, however, not able to get it to run when I set it as either a command in the Dockerfile or docker-compose.yml file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants