I’m trying to create and run a Rails app in container (Ruby image), however it exits 3 seconds after starting and the log is empty.
I’m creating the app using: docker-compose.exe run -d web rails new . --force --database=mysql --skip-bundle and run it with: docker-compose.exe up -d.
Here is my docker-compose.yml and rails.dockerfile:
version: ‘2’
services:
web:
build:
context: .
dockerfile: .docker/rails.dockerfile
volumes:
- .:/var/www
ports:
- "3000:3000"
depends_on:
- 'mysql'
networks:
- ddoc-network
mysql:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: 'SOMETHING'
networks:
- ddoc-network
networks:
ddoc-network:
driver: bridge
rails.dockerfile
FROM ruby:2.3.1
MAINTAINER Juliano Nunes
RUN apt-get update -qq && apt-get install -y build-essential mysql-client libmysqlclient-dev nodejs
RUN mkdir /var/www
WORKDIR /var/www
ADD Gemfile /var/www/Gemfile
ADD Gemfile.lock /var/www/Gemfile.lock
RUN bundle install
ADD . /var/www
CMD ['bundle', 'exec', 'rails', 'server', '-b', '0.0.0.0']
And this is the output of docker ps -a:
And the output of docker-compose logs web:
What is wrong?