docker - Docker 在 Jenkins 中使用 apt-get install 构建问题
问题描述
我正在尝试使用 JENKINSFILE 在詹金斯内部构建一个 docker 映像。当我在本地构建它时它工作正常,但是在詹金斯上我得到了同伴的输出
本地我使用相同的命令,但它有效。
有没有人知道为什么它不适用于詹金斯?
更新:
+ docker build --no-cache -t app:build .
Sending build context to Docker daemon 11.87MB
Step 1/17 : FROM golang:1.14.3-stretch
---> cc1f903b6fe7
Step 2/17 : RUN mkdir -p /app
---> Running in b8a0f9f5c73f
Removing intermediate container b8a0f9f5c73f
---> b555e33481ca
Step 3/17 : RUN echo nameserver 8.8.8.8 >> /etc/resolv.conf && cat /etc/resolv.conf
---> Running in fb7779fc731a
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 8.8.8.8
Removing intermediate container fb7779fc731a
---> 8445167d56f7
Step 4/17 : RUN chmod 777 /etc/resolv.conf
---> Running in d910167101cf
Removing intermediate container d910167101cf
---> eeb553e7fb83
Step 5/17 : RUN apt-get update && yes | apt-get install libxml2
---> Running in 3c09069d085c
Err:1 http://security.debian.org/debian-security stretch/updates InRelease
Could not resolve 'security.debian.org'
Err:2 http://deb.debian.org/debian stretch InRelease
Could not resolve 'deb.debian.org'
Err:3 http://deb.debian.org/debian stretch-updates InRelease
Could not resolve 'deb.debian.org'
Reading package lists...
[91mW: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease Could not resolve 'deb.debian.org'[0m[91m
W: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/InRelease Could not resolve 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease Could not resolve 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
[0mReading package lists...
Building dependency tree...
Reading state information...
Package libxml2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
[91mE: Package 'libxml2' has no installation candidate[0m[91m
[0mThe command '/bin/sh -c apt-get update && yes | apt-get install libxml2' returned a non-zero code: 100
谢谢!
解决方案
推荐阅读
- sqlite - Flutter:SQLite 的收藏夹功能 - 首次加载时出现问题
- python - 在 matplotlib 中对 pandas 数据框进行条件绘图
- python - 如何从给定列表创建字典?
- javascript - Google Apps脚本从Google表格中的URL下载文件?
- java - 返回每 2 个值相加的新数组?
- php - 向队列中的非注册用户(电子邮件列表)发送邮件
- flutter - 如何创建无法通过 Flutter 中的后退按钮访问旧页面的页面转换?
- java - swt 外壳和组件的最小尺寸
- python - 基于多个参数的切片列表
- yocto - 当我添加 PAM 支持时,pam_cracklib.so 没有添加到我的 Rocko 构建中