J'essaye de construire l'application témoin ici. http://codepany.com/blog/rails-5-and-docker-puma-nginx/La construction de docker-compose échoue avec/bin/sh: apt-get: non trouvé
Quand je lance la construction docker-Compose:
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
Vous semblez utiliser alpin et non ubuntu. J'ai mis à jour les tags en conséquence afin que votre question obtienne une bonne visibilité. Veuillez vérifier quel gestionnaire de paquets utiliser pour alpin et non ubuntu. – vee
Merci, cela semble fonctionner maintenant. Si oui, je posterai la réponse. –
Evidemment, il n'y a pas d'apt-get sur Alpine Linux, ce n'est pas une distribution Debian (-based). Utilisez 'apk add ...' à la place. –