apt-get 无法在 docker+dokku 中使用自定义 sources.list 定位包
apt-get unable to locate package using custom sources.list in docker+dokku
我在启动 Dokku 应用程序时尝试使用 apt-get
安装软件包时遇到问题。
快速上下文:
我正在与 Dokku 一起使用的构建包,<the-app>/.buildpacks
:
https://github.com/auricapps/heroku-buildpack-apt
https://github.com/heroku/heroku-buildpack-python
我要安装的软件包,<the-app>/Aptfile
:
libxml2-dev
libxmlsec1-dev
libxslt1-dev
pkg-config
python3-dev
zlib1g-dev
在故障排除中,我注意到源存储库在 /etc/apt/sources.list
和 /etc/apt/sources.list.d
中不可用,因此我在 Heroku Apt buildpack to allow the use of a custom source list. Here is the custom buildpack, and here 的基础上进行了特定更改以允许自定义sources.list
通过添加 Sourcefile
.
我包括的来源,<the-app>/Sourcefile
:
deb http://archive.ubuntu.com/ubuntu trusty main restricted
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted
deb http://archive.ubuntu.com/ubuntu trusty universe
deb-src http://archive.ubuntu.com/ubuntu trusty universe
deb http://archive.ubuntu.com/ubuntu trusty-updates universe
deb-src http://archive.ubuntu.com/ubuntu trusty-updates universe
deb http://archive.ubuntu.com/ubuntu trusty multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty-updates multiverse
deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main
deb-src http://security.ubuntu.com/ubuntu trusty-security main
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
问题:
然而,仍然没有快乐,因为 apt-get install
仍然回复说无法找到我要安装的软件包:
Counting objects: 127, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (117/117), done.
Writing objects: 100% (127/127), 18.22 KiB | 0 bytes/s, done.
Total 127 (delta 51), reused 0 (delta 0)
-----> Cleaning up...
-----> Building security-test from herokuish...
-----> Adding BUILD_ENV to build environment...
-----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected buildpacks: multi python
-----> Multipack app detected
remote: ownloading Buildpack: https://github.com/auricapps/heroku-buildpack-apt
=====> Detected Framework: Apt
-----> Found Sourcefile, temporarily using it as sources.list
...
remote: etching .debs for libxml2-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package libxml2-dev
remote: etching .debs for libxmlsec1-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package libxmlsec1-dev
remote: etching .debs for libxslt1-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package libxslt1-dev
remote: etching .debs for pkg-config
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package pkg-config
remote: etching .debs for python3-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package python3-dev
remote: etching .debs for zlib1g-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package zlib1g-dev
...
有任何提示/帮助吗?非常感谢!
仅使用自定义 Dockerfile 即可解决。在某些时候,我会花更多时间来了解使用 dokku-apt buildpack 的问题是什么。
FROM heroku/cedar:14
ARG secret_key
RUN curl https://github.com/gliderlabs/herokuish/releases/download/v0.3.26/herokuish_0.3.26_linux_x86_64.tgz \
--silent -L | tar -xzC /bin
RUN /bin/herokuish buildpack install \
&& ln -s /bin/herokuish /build \
&& ln -s /bin/herokuish /start \
&& ln -s /bin/herokuish /exec
COPY . /app
RUN bash /app/include/default_user.bash && rm -f /app/include/default_user.bash
RUN apt-get -qq -o dir::etc::sourcelist=/app/include/sources.list update \
&& apt-get -qq -o dir::etc::sourcelist=/app/include/sources.list -y --force-yes install \
libxml2-dev \
libxmlsec1-dev \
libxslt1-dev \
pkg-config \
python3-dev \
zlib1g-dev
ENV SECRET_KEY $secret_key
RUN /bin/herokuish buildpack build
我在启动 Dokku 应用程序时尝试使用 apt-get
安装软件包时遇到问题。
快速上下文:
我正在与 Dokku 一起使用的构建包,<the-app>/.buildpacks
:
https://github.com/auricapps/heroku-buildpack-apt
https://github.com/heroku/heroku-buildpack-python
我要安装的软件包,<the-app>/Aptfile
:
libxml2-dev
libxmlsec1-dev
libxslt1-dev
pkg-config
python3-dev
zlib1g-dev
在故障排除中,我注意到源存储库在 /etc/apt/sources.list
和 /etc/apt/sources.list.d
中不可用,因此我在 Heroku Apt buildpack to allow the use of a custom source list. Here is the custom buildpack, and here 的基础上进行了特定更改以允许自定义sources.list
通过添加 Sourcefile
.
我包括的来源,<the-app>/Sourcefile
:
deb http://archive.ubuntu.com/ubuntu trusty main restricted
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted
deb http://archive.ubuntu.com/ubuntu trusty universe
deb-src http://archive.ubuntu.com/ubuntu trusty universe
deb http://archive.ubuntu.com/ubuntu trusty-updates universe
deb-src http://archive.ubuntu.com/ubuntu trusty-updates universe
deb http://archive.ubuntu.com/ubuntu trusty multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty-updates multiverse
deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main
deb-src http://security.ubuntu.com/ubuntu trusty-security main
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
问题:
然而,仍然没有快乐,因为 apt-get install
仍然回复说无法找到我要安装的软件包:
Counting objects: 127, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (117/117), done.
Writing objects: 100% (127/127), 18.22 KiB | 0 bytes/s, done.
Total 127 (delta 51), reused 0 (delta 0)
-----> Cleaning up...
-----> Building security-test from herokuish...
-----> Adding BUILD_ENV to build environment...
-----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected buildpacks: multi python
-----> Multipack app detected
remote: ownloading Buildpack: https://github.com/auricapps/heroku-buildpack-apt
=====> Detected Framework: Apt
-----> Found Sourcefile, temporarily using it as sources.list
...
remote: etching .debs for libxml2-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package libxml2-dev
remote: etching .debs for libxmlsec1-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package libxmlsec1-dev
remote: etching .debs for libxslt1-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package libxslt1-dev
remote: etching .debs for pkg-config
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package pkg-config
remote: etching .debs for python3-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package python3-dev
remote: etching .debs for zlib1g-dev
Reading package lists...
Building dependency tree...
remote: E: Unable to locate package zlib1g-dev
...
有任何提示/帮助吗?非常感谢!
仅使用自定义 Dockerfile 即可解决。在某些时候,我会花更多时间来了解使用 dokku-apt buildpack 的问题是什么。
FROM heroku/cedar:14
ARG secret_key
RUN curl https://github.com/gliderlabs/herokuish/releases/download/v0.3.26/herokuish_0.3.26_linux_x86_64.tgz \
--silent -L | tar -xzC /bin
RUN /bin/herokuish buildpack install \
&& ln -s /bin/herokuish /build \
&& ln -s /bin/herokuish /start \
&& ln -s /bin/herokuish /exec
COPY . /app
RUN bash /app/include/default_user.bash && rm -f /app/include/default_user.bash
RUN apt-get -qq -o dir::etc::sourcelist=/app/include/sources.list update \
&& apt-get -qq -o dir::etc::sourcelist=/app/include/sources.list -y --force-yes install \
libxml2-dev \
libxmlsec1-dev \
libxslt1-dev \
pkg-config \
python3-dev \
zlib1g-dev
ENV SECRET_KEY $secret_key
RUN /bin/herokuish buildpack build