使用Dockerfile构buildDocker镜像时出错
我正在尝试在Dockerfile
使用configuration来构buildDockerfile
:
FROM ubuntu MAINTAINER axiom88guru(axiom88guru@gmail.com) Configuration for app below. Run upgrades RUN apt-get update Install basic packages RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs Install Ruby RUN apt-get -qq -y install ruby-full RUN gem install bundler --no-ri --no-rdoc RUN gem install foreman Install rails-new-docker WORKDIR /app RUN git clone https://github.com/axiom88-guru/rails-docker.git /app RUN bundle install --without development test Run rails-new-docker ENV SECRET_KEY_BASE dockerkeybase ENV RAILS_ENV production EXPOSE 5959 CMD foreman start -f Procfile
当我在bash中运行这些命令时,它们按预期方式工作,但在docker build期间不工作:
Removing intermediate container 344e99851852 Step 8/14 : WORKDIR /app —> 3c204a395f23 Removing intermediate container 680b1841a3fc Step 9/14 : RUN git clone https://github.com/axiom88-guru/rails-docker.git /app —> Running in d7a9de9f6ab5 /bin/sh: 1: git: not found The command '/bin/sh -c git clone https://github.com/axiom88-guru/rails-docker.git /app' returned a non-zero code: 127
任何人都可以帮我找出解决scheme吗?
需要安装git,因为基本的ubuntu
镜像只提供了一小部分已安装的软件包(这样做是为了保持较小的图像大小)。
FROM ubuntu MAINTAINER axiom88guru(axiom88guru@gmail.com) # Configuration for app below. # Run upgrades RUN apt-get update # Install basic packages RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs git # Install Ruby RUN apt-get -qq -y install ruby-full RUN gem install bundler --no-ri --no-rdoc RUN gem install foreman # Install rails-new-docker WORKDIR /app RUN git clone https://github.com/axiom88-guru/rails-docker.git /app RUN bundle install --without development test # Run rails-new-docker ENV SECRET_KEY_BASE dockerkeybase ENV RAILS_ENV production EXPOSE 5959 CMD foreman start -f Procfile
这个版本应该工作。 我只是将git
添加到第一个apt-get install
步骤。
- Docker和Github集成 – Github文件在哪里?
- docker化jenkins崩溃,因为一个Java分配内存
- 从本地运行的Bluemix Liberty泊坞窗镜像访问Liberty日志文件
- Docker – 在代理上运行Flask Web应用程序
- SpringBoot @RestController不能从外部的docker容器访问
- Elastic Beanstalk / Docker – 没有这样的文件或目录package.json
- 一个图像可以有一个自定义的默认shm大小?
- gem:找不到命令
- bluemix docker容器绑定到mongodb('MongoError',消息:'connect ENETUNREACH')