尝试构建客户postgres Docker镜像时出错

时间:2015-09-27 18:36:35

标签: docker

我有以下Dockerfile

FROM ubuntu:14.04
MAINTAINER Mike Dillon <mike@appropriate.io>

ENV POSTGIS_MAJOR 2.1
ENV POSTGIS_VERSION 2.1.7+dfsg-3~94.git954a8d0.pgdg80+1

RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:ubuntugis/ppa

# temporary instruction, i beleive all the apt-get etc commands will need to be RUN in th$
# RUN -t -i ubuntu:14.04 /bin/bash

RUN apt-get install -y postgresql-client
RUN apt-get update && apt-get install -y --no-install-recommends postgresql-$PG_MAJOR-pos$

#RUN apt-get update  && apt-get install -y --no-install-recommends postgresql-$PG_MAJOR-p$
#postgis=$POSTGIS_VERSION && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d

当我运行这个Dockerfile时,我在第7步得到以下结果:

Step 7 : RUN apt-get update && apt-get install -y --no-install-recommends postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION postgis=$POSTGIS_VERSION && rm -rf /var/lib/apt/lists/*
 ---> Running in 8b0e852f7999
Ign http://ppa.launchpad.net trusty InRelease
Ign http://archive.ubuntu.com trusty InRelease
Ign http://ppa.launchpad.net trusty Release.gpg
Ign http://archive.ubuntu.com trusty-updates InRelease
Ign http://ppa.launchpad.net trusty Release
Ign http://archive.ubuntu.com trusty-security InRelease
Err http://ppa.launchpad.net trusty/main amd64 Packages

Hit http://archive.ubuntu.com trusty Release.gpg
Err http://ppa.launchpad.net trusty/main amd64 Packages

Err http://ppa.launchpad.net trusty/main amd64 Packages

Get:1 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
Err http://ppa.launchpad.net trusty/main amd64 Packages

Get:2 http://archive.ubuntu.com trusty-security Release.gpg [933 B]
Err http://ppa.launchpad.net trusty/main amd64 Packages
  404  Not Found
Hit http://archive.ubuntu.com trusty Release
Get:3 http://archive.ubuntu.com trusty-updates Release [63.5 kB]
Get:4 http://archive.ubuntu.com trusty-security Release [63.5 kB]
Get:5 http://archive.ubuntu.com trusty/main Sources [1335 kB]
Get:6 http://archive.ubuntu.com trusty/restricted Sources [5335 B]
Get:7 http://archive.ubuntu.com trusty/universe Sources [7926 kB]
Get:8 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]
Get:9 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]
Get:10 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]
Get:11 http://archive.ubuntu.com trusty-updates/main Sources [296 kB]
Get:12 http://archive.ubuntu.com trusty-updates/restricted Sources [4521 B]
Get:13 http://archive.ubuntu.com trusty-updates/universe Sources [174 kB]
Get:14 http://archive.ubuntu.com trusty-updates/main amd64 Packages [782 kB]
Get:15 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [22.7 kB]
Get:16 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [415 kB]
Get:17 http://archive.ubuntu.com trusty-security/main Sources [121 kB]
Get:18 http://archive.ubuntu.com trusty-security/restricted Sources [1874 B]
Get:19 http://archive.ubuntu.com trusty-security/universe Sources [35.4 kB]
Get:20 http://archive.ubuntu.com trusty-security/main amd64 Packages [434 kB]
Get:21 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [14.8 kB]
Get:22 http://archive.ubuntu.com trusty-security/universe amd64 Packages [151 kB]
Fetched 21.2 MB in 1min 30s (233 kB/s)
W: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION postgis=$POSTGIS_VERSION && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

构建在步骤7失败。为什么我会收到此错误,我该怎么做才能克服它?

谢谢。

亚历-Z。

1 个答案:

答案 0 :(得分:1)

您正在尝试使用PPA ppa:ubuntugis/ppa。当您执行apt-get update时,apt-get正在尝试从此新来源获取可用数据包列表。但是,此PPA很长时间没有更新,因此没有可用于您使用的ubuntu版本trusty 14.4

以下是此PPA可用的ubuntu版本列表:http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/dists/

您可以从较旧的ubuntu版本(FROM ubuntu:12.04)开始,也可以找到提供所需软件包和postgis版本的其他来源。