I am launching two docker containers. One with rails and one with Postgres db. Here is my docker file:
# Docs: https://docs.docker.com/compose/compose-file/ version: '2' services: db: image: postgres environment: - POSTGRES_PASSWORD=xxx rails: build: . command: rails s -p 3000 -b '0.0.0.0' volumes: - .:/app ports: - "3000:3000" links: - db depends_on: - db
Here's the Docker file for the rails application:
FROM ruby:2.3 RUN apt-get update RUN apt-get install -y build-essential nodejs RUN mkdir -p /app WORKDIR /app COPY Gemfile Gemfile.lock ./ RUN gem install bundler && bundle install --jobs 20 --retry 5 COPY . ./ EXPOSE 3000 ENTRYPOINT ["bundle", "exec"] CMD ["rails", "server", "-b", "0.0.0.0"]
When I run docker-compose up , everything works fine, and I can connect to the server via the ip address from the docker machine.
When I try to connect to the container with the following command:
docker-compose run rails console
I get this error:
Could not find rake-11.1.2 in any of the sources Run `bundle install` to install missing gems.
installing the bag inside the container has no effect, and the specified stone is definitely installed. In other questions, it was mentioned that I should run bin/spring stop . So I ran:
docker-compose run bin/spring stop
And it returns:
Spring is not running
I'm still new to rubies / rails and docker. Hope someone can help me! thanks in advance
PS: Dockerfiles comments appreciated!