我正在使用来dockerfile
构建图像:
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
COPY ./scratch-desktop_3.3.0_amd64.deb /opt/scratch3-desktop.deb
RUN dpkg -i /opt/scratch3-desktop.deb
RUN apt-get install -f
CMD [ "scratch-desktop" ]
但是当我使用docker-compose build
命令时,它在安装 Debian 软件包的阶段引发了一个错误,
dpkg: dependency problems prevent configuration of scratch-desktop:
scratch-desktop depends on libgtk-3-0; however:
Package libgtk-3-0 is not installed.
scratch-desktop depends on libnotify4; however:
Package libnotify4 is not installed.
scratch-desktop depends on libnss3; however:
Package libnss3 is not installed.
scratch-desktop depends on libxss1; however:
Package libxss1 is not installed.
scratch-desktop depends on libxtst6; however:
Package libxtst6 is not installed.
scratch-desktop depends on xdg-utils; however:
Package xdg-utils is not installed.
scratch-desktop depends on kde-cli-tools | kde-runtime | trash-cli | libglib2.0-bin | gvfs-bin; however:
Package kde-cli-tools is not installed.
Package kde-runtime is not installed.
Package trash-cli is not installed.
Package libglib2.0-bin is not installed.
Package gvfs-bin is not installed.
dpkg: error processing package scratch-desktop (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
scratch-desktop
ERROR: Service 'scratch' failed to build: The command '/bin/sh -c dpkg -i /opt/scratch3-desktop.deb' returned a non-zero code: 1
答案1
使用
RUN apt-get install -y /opt/scratch3-desktop.deb
代替RUN dpkg -i ...
。