'Unable to start new Rails project from within Ruby's Alpine docker image
I have a docker image with the following Dockerfile based on Ruby's Alpine docker image.
FROM ruby:2.6.5-alpine3.10
RUN apk add --no-cache build-base \
bash \
postgresql-dev;
RUN gem install rails
When I run rails new ., I don't see any error but many directories that should be generated as a result of the command are not generated. Here is what I see:
→ docker-compose run app rails new . --database=postgresql
exist
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
However, if I build a docker image based on Ubuntu, rails new . generates all the directories and files as excepted.
Could I be overlooking some configuration or setup?
Solution 1:[1]
Git is not installed on your docker image. Below steps fixed the problem:
- Add git to your DockerFile
RUN apk add --no-cache build-base \ bash \ postgresql-dev \ git;
docker-compose builddocker-compose run app rails new . --database=postgresql
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Moustafa Mahran |
