A
A
Anton Misyagin2019-01-23 12:20:10
Ruby on Rails
Anton Misyagin, 2019-01-23 12:20:10

Gem not found when starting docker container based on official ruby ​​image?

I'm trying to run Ruby on Rails 5.2 inside a container. It works, but not completely. I will briefly describe first. I launch a pack of containers in conjunction with the database, nginx using docker-compose - the rail container does not start. Throws an error I can't find the Puma gem when executing the foreman start command. The goal is to fix this problem.
If you manually launch this container with the command:

docker run -it -v sourcecodes:mountedsourses my_rails_app_image /bin/bash

I find myself inside my container and start foreman start - it gives an error that there is no gem from the dev environment. Then I start RAILS_ENV=staging foreman start and everything rustles and sees the cougar from somewhere.
Now my docker-compose.yml is:
version: "3.3"
services:
  pg:
    image: postgres:11.1-alpine
    restart: on-failure:5
    ports:
      - 5432:5432
    volumes:
      - ~/4e4o/shared/db/pg/etc:/etc/postgresql:Z
      - ~/4e4o/shared/db/pg/log:/var/log/postgresql:Z
      - ~/4e4o/shared/db/pg/data:/var/lib/postgresql/data:Z
  redis:
    image: redis:5.0.3-alpine
    restart: on-failure:5
    ports:
      - 6380:6380
  app:
    build:
      context: .
      dockerfile: ./docker/stage/rails/DockerFile
    environment:
      - BUNDLE_PATH=/bundle
      - RAILS_ENV=staging
    ports:
      - 5000:5000
    depends_on:
      - pg
      - redis
    volumes:
      - bundle:/bundle:Z
      - .:/4e4o:Z
    command: foreman start
  web:
    build:
      context: .
      dockerfile: ./docker/stage/nginx/DockerFile
    restart: on-failure:5
    depends_on:
      - app
    ports:
      - 80:80
    volumes:
      - ./4e4o/shared/log/nginx:/var/log/nginx:Z
      - ./4e4o/current:/4e4o
volumes:
  bundle:


ProcFile:
backend: RAILS_ENV=$RAILS_ENV bundle exec rails s -p 5000


There is another similar problem, but I will describe it in another topic

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question