What I want
I want to create Rails projects with docker
Problem
When I command this, The error is happend
sudo docker-compose run api rails new . --force --no-deps --database=po stgresql
standard_init_linux.go:211: exec user process caused "no such file or directory"
refer to URL
standard_init_linux.go:190: exec user process caused "no such file or directory" - Docker
code
docker-compose
FROM ruby:2.6.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /api
WORKDIR /api
COPY ./api/Gemfile /api/Gemfile
COPY ./api/Gemfile.lock /api/Gemfile.lock
RUN bundle install
COPY ./api/ /api
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]
docker-compose.yml
version: '3'
services:
db:
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data
api:
build:
context: ./
dockerfile: ./docker/Dockerfile
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- ./api:/api
ports:
- "3000:3000"
depends_on:
- db
version
docker-compose v3 rails v6
How can I fix it? Thank you