Dockerfile FROM ruby:2.3.1-alpine RUN apk --update --no-cache add build-base imagemagick less libxml2-dev libxslt-dev postgresql-dev && mkdir -p /app WORKDIR /app COPY Gemfile Gemfile.lock ./ RUN gem install bundler && bundle config build.nokogiri --use-system-libraries && bundle install COPY . ./ CMD ["script/docker-entrypoint.sh"] Part of docker-compose.yml version: "2" services: app: build: . depends_on: - postgres - rabbitmq - redis links: - postgres - rabbitmq - redis volumes: - .:/app - app-logs:/app/log - app-uploads:/app/public/uploads env_file: .env How to use? $ docker-compose run --rm app rspec spec