基础包中未满足的依赖关系 - jenkins dockerfile

基础包中未满足的依赖关系 - jenkins dockerfile

下面是 dockerfile:

FROM jenkins:2.60.3

ENV DEBIAN_FRONTEND=noninteractive

USER root
ARG DOCKER_GID=497

RUN groupadd -g ${DOCKER_GID:-497} docker

ARG DOCKER_ENGINE=1.10.2
ARG DOCKER_COMPOSE=1.6.2

# Install base packages for docker, docker-compose & ansible
RUN apt-get update -y && \
    apt-get install apt-transport-https curl python-dev python-setuptools gcc make libssl-dev -y && \
    easy_install pip

# Install docker engine
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
    echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | tee /etc/apt/sources.list.d/docker.list && \
    apt-get update -y && \
    apt-get purge lxc-docker* -y && \
    apt-get install docker-engine=${DOCKER_ENGINE:-1.10.2}-0~trusty -y && \
    usermod -aG docker jenkins && \
    usermod -aG users jenkins

# Install docker compose
RUN pip install docker-compose==${DOCKER_COMPOSE:-1.6.2} && \
    pip install ansible boto boto3

# Change to jenkins user
USER jenkins

# Add jenkins plugin
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt

给出以下错误:

Step 9/14 : RUN apt-get update -y &&     apt-get install apt-transport-https curl python-dev python-setuptools gcc make libssl-dev -y &&     easy_install pip
 ---> Using cache
 ---> 297087071292
Step 10/14 : RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D &&     echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | tee /etc/apt/sources.list.d/docker.list &&     apt-get update -y &&     apt-get purge lxc-docker* -y &&     apt-get install docker-engine=${DOCKER_ENGINE:-1.10.2}-0~trusty -y &&     usermod -aG docker jenkins &&     usermod -aG users jenkins
 ---> Running in 10daeb70c472
Warning: apt-key output should not be parsed (stdout is not a terminal)
Executing: /tmp/apt-key-gpghome.ls7Ck5WuuS/gpg.1.sh --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
gpg: key F76221572C52609D: public key "Docker Release Tool (releasedocker) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1
deb https://apt.dockerproject.org/repo ubuntu-trusty main
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Hit:4 http://deb.debian.org/debian stretch Release
Get:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [500 kB]
Get:6 https://apt.dockerproject.org/repo ubuntu-trusty InRelease [48.7 kB]
Get:8 https://apt.dockerproject.org/repo ubuntu-trusty/main amd64 Packages [7033 B]
Fetched 741 kB in 1s (606 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Package 'lxc-docker' is not installed, so not removed
Package 'lxc-docker-virtual-package' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 57 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 docker-engine : Depends: libsystemd-journal0 (>= 201) but it is not installable
                 Recommends: aufs-tools but it is not going to be installed
                 Recommends: cgroupfs-mount but it is not going to be installed or
                             cgroup-lite but it is not installable
                 Recommends: apparmor but it is not going to be installed
                 Recommends: yubico-piv-tool (>= 1.1.0~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
ERROR: Service 'jenkins' failed to build: The command '/bin/sh -c apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D &&     echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | tee /etc/apt/sources.list.d/docker.list &&     apt-get update -y &&     apt-get purge lxc-docker* -y &&     apt-get install docker-engine=${DOCKER_ENGINE:-1.10.2}-0~trusty -y &&     usermod -aG docker jenkins &&     usermod -aG users jenkins' returned a non-zero code: 100

以下说明导致此错误:

  apt-get install docker-engine=${DOCKER_ENGINE:-1.10.2}-0~trusty -y
  deb https://apt.dockerproject.org/repo ubuntu-trusty main

1)如何解决这些未满足的依赖关系?

2)推荐使用哪个版本的Jenkins?当前使用基础镜像2.60.3

答案1

从提供的输出来看,您的具体问题是您要安装的软件包依赖于libsystemd-journal0,并且您没有配置提供该软件包的存储库。您似乎在该容器内混合了 Debian 和 Ubuntu 存储库,这可能是问题的根源。

据我所知,您使用的 Docker 映像甚至不是 Ubuntu,它运行在 Debian Stretch 上,因此您不应该在该容器内安装 Ubuntu Docker 存储库。

一旦您使用 Debian Stretch 的 Docker 存储库创建了一个容器,它就应该构建。

你的另一个问题是,你试图让 Docker 在 Docker 中运行,你会发现它有一些自己的问题/限制,但一旦容器构建完毕,你可能会遇到这个问题,并且可能应该作为附加问题提交。

至于推荐的 Jenkins Docker 镜像,链接从您当前使用的图像带我到这个图片openjdk-8它看起来也在Debian Stretch 上运行。

相关内容