Docker映像无法安装编译器

时间:2020-09-28 19:23:47

标签: docker dockerfile docker-image

我有以下用于创建docker映像的docker文件,我需要在其中安装几个编译器。但是以某种方式在安装php,java,g ++等软件包时出现错误

这是docker文件

############################################################
# Dockerfile to build sandbox for executing user code
# Based on Ubuntu
############################################################

FROM ubuntu:latest


# Update the repository sources list
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
RUN apt-get update
#RUN apt-get upgrade
#Install all the languages/compilers we are supporting.
RUN apt-get install -y gcc
RUN apt-get install -y g++
RUN apt-get install -y php5-cli
RUN apt-get install -y ruby
RUN apt-get install -y python
RUN apt-get install -y mono-xsp2 mono-xsp2-base

RUN apt-get install -y mono-vbnc
RUN apt-get install -y npm
RUN apt-get install -y golang-go    
RUN apt-get install -y nodejs

RUN npm install -g underscore request express jade shelljs passport http sys jquery lodash async mocha moment connect validator restify ejs ws co when helmet wrench brain mustache should backbone forever  debug && export NODE_PATH=/usr/local/lib/node_modules/

RUN apt-get install -y clojure1.4


#prepare for Java download
RUN apt-get install -y python-software-properties
RUN apt-get install -y software-properties-common

#grab oracle java (auto accept licence)
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get update
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-get install -y oracle-java8-installer


RUN apt-get install -y gobjc
RUN apt-get install -y gnustep-devel &&  sed -i 's/#define BASE_NATIVE_OBJC_EXCEPTIONS     1/#define BASE_NATIVE_OBJC_EXCEPTIONS     0/g' /usr/include/GNUstep/GNUstepBase/GSConfig.h


RUN apt-get install -y scala
RUN apt-get install -y mysql-server
RUN apt-get install -y perl

RUN apt-get install -y curl
RUN mkdir -p /opt/rust && \
    curl https://sh.rustup.rs -sSf | HOME=/opt/rust sh -s -- --no-modify-path -y && \
    chmod -R 777 /opt/rust

RUN apt-get install -y sudo
RUN apt-get install -y bc

RUN echo "mysql ALL = NOPASSWD: /usr/sbin/service mysql start" | cat >> /etc/sudoers

我已经尝试过多次更改此代码,但仍然以诸如以下的错误结尾

The following packages have unmet dependencies:
 g++ : Depends: g++-4.8 (>= 4.8.2-5~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get install -y g++' returned a non-zero code: 100

所以我最终添加了以下几行

RUN apt-get -f install -y libc6
RUN apt-get install -y manpages-dev
RUN apt-get install -y libc-dev-bin
RUN apt-get install -y libc6-dev
RUN apt-get install -y libstdc++-4.8-dev

但是我还是被卡住了

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.19-0ubuntu6) but 2.31-0ubuntu9.1 is to be installed
             Depends: libc-dev-bin (= 2.19-0ubuntu6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get install -y libc6-dev' returned a non-zero code: 100

同样php安装中存在这些错误

 php5-cli : Depends: php5-common (= 5.5.9+dfsg-1ubuntu4) but it is not going to be installed
            Depends: libedit2 (>= 2.11-20080614-4) but it is not going to be installed
            Recommends: php5-readline but it is not going to be installed

我知道问题出在某些未满足的依赖关系上,但是每次我解决一个问题时,都会出现另一个问题。有没有一种方法可以安装所有依赖项。

我也从https://github.com/remoteinterview/compilebox获得了这个docker文件,它是为Ubuntu 14.04编写的,也无法正常工作,所以我改成了ubuntu:latest

我是Docker的新手,所以我不太想写dockerfile,有些请帮助我更新此dockerfile。

预先感谢

0 个答案:

没有答案