2017-08-30 172 views
0

由於我安裝了Capybara-webkit,因此無法使用docker撰寫我的規格。保留下一個命令住宿:Docker-compose和Xvfb不兼容?

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

我想我有水豚,WebKit的一個問題,所以我創建了一個SO questionan issue on the repo,但似乎它的碼頭工人,撰寫和xvfb的相互作用的更多的是PB。

如果我做的第一

$ docker-compose run web bash 

然後

$ xvfb-run -a bundle exec rspec spec 

它工作正常。我沒有任何線索。

編輯31/08/17

按照要求,這裏是泊塢窗,撰寫文件:

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 

而且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 . . 
+0

喬摩天,水豚,WebKit的創造者,給了我三根導線: - 默認的shell - 標準輸入 - 交互與非交互的shell調用。 – Ruff9

+0

你試過這個'docker-compose run web/bin/bash -c「xvfb-run -a bundle exec rspec」'。你也可以嘗試另一個,看看它是否有效。您也可以嘗試另一個版本'docker-compose run web/bin/bash -c「exec xvfb-run -a bundle exec rspec」' –

+0

兩者都給了我相同的響應:'錯誤:無法啓動服務web:oci運行時錯誤: container_linux.go:262:啓動容器進程導致「exec:\」/ bin \「:權限被拒絕」「 – Ruff9

回答

0

發佈評論的答案因爲我需要格式化

可以嘗試更改以下

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

entrypoint: xvfb-run -a bundle exec rspec 

,並嘗試docker-compose up

此外,如果不工作,那麼嘗試加入tty: true到服務

0

在docker- compose.yml

command: ./start.sh 

而且在start.sh文件

#!/bin/bash 
xvfb-run "run whatever"