繁体   English   中英

docker-compose构建因/ bin / sh而失败:apt-get:找不到

[英]docker-compose build fails with /bin/sh: apt-get: not found

我正在尝试在此处构建示例应用程序。 http://codepany.com/blog/rails-5-and-docker-puma-nginx/

当我运行docker-compose build时:

Step 1/13 : FROM ruby:2.4-alpine
  ---> 64419e20d6c5
Step 2/13 : RUN apt-get update -qq && apt-get install -y build-
essential libpq-dev nodejs
---> Running in 98d4ed713984
/bin/sh: apt-get: not found
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-
get update -qq && apt-get install -y build-essential libpq-dev 
nodejs' returned a non-zero code: 127

Dockerfile:

FROM ruby:2.4-alpine
# Base image:
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs

# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/sample_rails_docker_app
RUN mkdir -p $RAILS_ROOT

# Set working directory, where the commands will be ran:
WORKDIR $RAILS_ROOT

# Gems:
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN gem install bundler
RUN bundle install

COPY config/puma.rb config/puma.rb

# Copy the main application.
COPY . .

EXPOSE 3000

# The default command that gets ran will be to start the Puma server.
CMD bundle exec puma -C config/puma.rb

感谢您的评论,我使其与以下产品一起使用:

  1. 已安装rpm ruby 2.4.1
  2. Dockerfile已更新为FROM ruby:2.4-alpine (教程使用ruby 3.2.1)

ruby2.4.1-alpine_rails中安装ruby2.4.1-alpine_rails之后,我用ruby:2.4.1替换了ruby:2.4.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM