Docker image cannot install compilers

199 Views Asked by At

I have the following docker file for creating a docker image, where I need to install several compiler. But somehow I get errors while installing those packages like php, java, g++ etc

Here is the docker file

############################################################
# 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

I've tried changing this code several times but it still ends with some errors like

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

So I ended up adding the following lines

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

But somehow I'm stuck on

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

Also the php installation is having these errors

 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

I know the problem is with some unmet dependencies, but every-time I solve one, another one arises. Is there a way to install all the dependencies.

Also I got this docker file from https://github.com/remoteinterview/compilebox & it was written for Ubuntu 14.04 & it wasn't working either so I've changed to ubuntu:latest

I'm new to docker so I don't much about writing dockerfile, some please help me update this dockerfile.

Thanks in advance

0

There are 0 best solutions below