将GCC编译器安装到Docker容器上

将GCC编译器安装到Docker容器上

本文介绍了将GCC编译器安装到Docker容器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将mono软件包安装到Docker容器上,但是mono需要
git,autoconf,libtool,automake,build-essential,mono-devel,gettext软件包。

I am trying to install mono package onto a Docker container, but mono requiresgit , autoconf, libtool, automake, build-essential , mono-devel, gettext packages.

我遇到的问题是libtool需要libc-dev,而libc-dev需要gcc编译器。

the problem I am having is that libtool requires libc-dev, and libc-dev requires gcc compiler.

docker容器未安装任何编译器,但我的本地计算机已安装。

The docker container does not have any compiler installed, but my local machine does.

arcolombo@acolombo:~/Documents/bedgraph_dockerfile$ dpkg --list |grep    compiler
ii  g++                                                                 4:4.8.2-1ubuntu6                                    amd64        GNU C++ compiler
ii  g++-4.8                                                     4.8.2-19ubuntu1                                     amd64        GNU C++ compiler
ii  gcc                                                         4:4.8.2-1ubuntu6                                    amd64        GNU C compiler
ii  gcc-4.8                                                     4.8.2-19ubuntu1                                     amd64        GNU C compiler
ii  hardening-includes                                          2.5ubuntu2.1                                        all          Makefile for enabling compiler flags for security hardening
ii  libllvm3.5:amd64                                            1:3.5-4ubuntu2~trusty2                              amd64        Modular compiler and toolchain technologies, runtime library
ii  libmono-compilerservices-symbolwriter4.0-cil                   3.2.8+dfsg-4ubuntu1.1                               all          Mono.CompilerServices.SymbolWriter library (for CLI 4.0)
ii  libxkbcommon0:amd64                                         0.4.1-0ubuntu1                                      amd64        library interface to the XKB compiler - shared library
ii  mono-mcs                                                    3.2.8+dfsg-4ubuntu1.1                               all          Mono C# 2.0 / 3.0 / 4.0 / 5.0  compiler for CLI 2.0 / 4.0 / 4.5

所以我的问题是,将gcc编译器添加到Docker容器的最简单方法是什么?我应该在我的docker容器中创建这些编译器目录的一部分吗?

so my question is , what is the easiest way to get a gcc compiler onto a Docker container? should I just create a volume of these compiler directories into my docker container?

我认为可能需要它的原因是因为我正在运行一个网站,并且该网站可以执行

The reason I think I may need it is because I am running a website, and the website executes a docker image directly.

推荐答案

在您的Dockerfile中:

In your Dockerfile:

FROM ubuntu
# ...
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
    apt-get -y install gcc mono-mcs && \
    rm -rf /var/lib/apt/lists/*

这篇关于将GCC编译器安装到Docker容器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:58