2

Since I installed Capybara-webkit, I can't launch my specs with docker compose. The next command stays on hold:

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

I thought I have a problem with Capybara-webkit, so I created a SO question and an issue on the repo, but it seems it's more a pb of interaction between docker-compose and xvfb.

If I do first

$ docker-compose run web bash

then

$ xvfb-run -a bundle exec rspec spec

it works fine. I have no clue.

Edit 31/08/17

As requested, here is the docker-compose file:

version: '2'

services:

  db:
    image: mysql
    environment:
      - MYSQL_ROOT_PASSWORD=XXXXX
    volumes:
      - mysql-data:/var/lib/mysql

  redis:
    image: redis
    ports:
      - "6379:6379"
    volumes:
      - redis:/data

  web:
    build: .
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    volumes:
      - .:/app_dir
      - app-gems:/usr/local/bundle
    ports:
      - "3000:3000"
    depends_on:
      - db
      - redis

volumes:
  mysql-data:
    driver: local
  redis:
    driver: local
  app-gems:
    driver: local

And 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 . .
Ruff9
  • 1,163
  • 15
  • 34
  • Joe Ferris, creator of Capybara-webkit, gave me three leads: - the default shell - stdin - interactive vs non-interactive shell invocations. – Ruff9 Aug 30 '17 at 15:50
  • Did you try this `docker-compose run web /bin/bash -c "xvfb-run -a bundle exec rspec"`. You can also try another one and see if it works. You can also try another version `docker-compose run web /bin/bash -c "exec xvfb-run -a bundle exec rspec"` – Tarun Lalwani Aug 30 '17 at 16:08
  • Both gave me the same response : `ERROR: Cannot start service web: oci runtime error: container_linux.go:262: starting container process caused "exec: \"/bin\": permission denied"` – Ruff9 Aug 30 '17 at 16:10
  • There was a typo, please check the edited comment – Tarun Lalwani Aug 30 '17 at 16:12
  • Both stayed on hold, exactly like my original command :( – Ruff9 Aug 30 '17 at 16:20
  • Post your `docker-compose` file – Tarun Lalwani Aug 30 '17 at 18:24
  • Question updated – Ruff9 Aug 31 '17 at 08:17
  • Would need a sample git repo that i can use to debug this, without that it would be tough to understand – Tarun Lalwani Sep 03 '17 at 08:51
  • A while ago but any news in the subject? – Jakob Rasmussen Apr 13 '18 at 21:26
  • we made it work, but few month later we changed our mind and start using chromedriver instead of capybara-webkit. It just work better and don't need Qt. The capybara-webkit team seems to hesitate to kep maintening it. – Ruff9 Apr 16 '18 at 08:54

2 Answers2

3

In docker-compose.yml

command: ./start.sh

And in start.sh file

#!/bin/bash
xvfb-run "run whatever"
qqmikey
  • 84
  • 5
0

Posting comments as answer since I need formatting

Can you try changing below

command: bundle exec rails s -p 3000 -b '0.0.0.0'

to

entrypoint: xvfb-run -a bundle exec rspec

and try docker-compose up

Also if that doesn't work then try adding tty: true to the service

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265