我正在尝试将mono包安装到Docker容器上,但mono需要git,autoconf,libtool,automake,build-essential,mono-devel,gettext包.
我遇到的问题是libtool需要libc-dev,而libc-dev需要gcc编译器.
docker容器没有安装任何编译器,但我的本地机器没有.
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
Run Code Online (Sandbox Code Playgroud)
所以我的问题是,将gcc编译器放到Docker容器上最简单的方法是什么?我应该在我的docker容器中创建这些编译器目录的卷吗?
我认为我可能需要它的原因是因为我正在运行一个网站,并且该网站直接执行一个docker镜像.
Vit*_*aev 19
在你的Dockerfile中:
FROM ubuntu
# ...
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install gcc mono-mcs && \
rm -rf /var/lib/apt/lists/*
Run Code Online (Sandbox Code Playgroud)
nob*_*bar 14
据我了解,OP已经混淆了术语,可能意味着要问:
将GCC编译器安装到Docker 镜像上
我的答案首先解决问题的标题(关于容器),然后转到问题的意图(关于图像).
如果您可以在容器中运行BASH shell,那么您不需要操作Dockerfile.
比方说,例如,您尝试示例中的提示docker run hello-world:
docker run -it ubuntu bash
Run Code Online (Sandbox Code Playgroud)
然后从容器中的shell运行这些...
apt-get update
apt-get install gcc
Run Code Online (Sandbox Code Playgroud)
关键的一点是,apt-get install如果您没有首次运行,原始Docker容器可能无法按预期运行apt-get update.期待看到......
无法找到包gcc
试图安装时,该错误信息g++不apt-get update更是混乱,由于"正则表达式"替代.
另见:http://www.liquidweb.com/kb/how-to-list-and-attach-to-docker-containers
docker ps -a ## list all available containers
Run Code Online (Sandbox Code Playgroud)
和
docker exec -ti [CONTAINER ID] bash
Run Code Online (Sandbox Code Playgroud)
这种实时操作方法也可用于创建OP可能想要的图像.使用docker commit您直播的容器保存为一个新的形象.
您还可以获取已经安装了 GCC 和/或您需要的部分/大部分工具的官方镜像。docker store 已经设置了很多官方镜像:https ://store.docker.com/search?page_size=99&q =&source=verified
我不确定它是否是正确的单声道,但它们有单声道图像:https : //store.docker.com/images/4234a761-444b-4dea-a6b3-31bda725c427?tab=description
和官方 GCC 图像:https : //store.docker.com/images/06ad851d-f666-47d3-9ef3-e90535c141ec?tab=description
如果您要自己构建东西,还有 buildpack-deps:https : //store.docker.com/images/9e56c286-5b40-4838-89fe-fd513c9c3bd6
可以按类别浏览:https : //store.docker.com/search?page_size=99&q=&source=verified
并且还直接搜索 docker hub 以获取 mono 或您需要的任何内容:https : //hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q= mono&starCount =0
| 归档时间: |
|
| 查看次数: |
38004 次 |
| 最近记录: |