docker里安装ubuntu
使用 Ubuntu 官方镜像
Ubuntu 相关的镜像有很多,这里使用 -s 10 参数,只搜索那些被收藏 10 次以上的镜像
$ docker search -s 10 ubuntu NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Official Ubuntu base image 840 [OK]
dockerfile/ubuntu Trusted automated Ubuntu (http://www.ubunt... 30 [OK]
crashsystems/gitlab-docker A trusted, regularly updated build of GitL... 20 [OK]
sylvainlasnier/memcached This is a Memcached 1.4.14 docker images b... 16 [OK]
ubuntu-upstart Upstart is an event-based replacement for ... 16 [OK]
mbentley/ubuntu-django-uwsgi-nginx 16 [OK]
ansible/ubuntu14.04-ansible Ubuntu 14.04 LTS with ansible 15 [OK]
clue/ttrss The Tiny Tiny RSS feed reader allows you t... 14 [OK]
dockerfile/ubuntu-desktop Trusted automated Ubuntu Desktop (LXDE) (h... 14 [OK]
tutum/ubuntu Ubuntu image with SSH access. For the root... 12 [OK]
注意,Docker 1.12 版本中已经不支持 --stars 参数,则可以使用 -f stars=N 参数。
根据搜索出来的结果,读者可以自行选择下载镜像并使用。
下面以 ubuntu 14.04 为例,演示如何使用该镜像安装一些常用软件。
首先使用 -ti 参数启动容器,登录 bash,查看 ubuntu 的发行版本号。
Ubuntu
基本信息
Ubuntu 是流行的 Linux 发行版,其自带软件版本往往较新一些。
该仓库位于 https://hub.docker.com/_/ubuntu/ ,提供了 Ubuntu 从 12.04 ~ 16.10 各个版本的镜像。
使用方法
默认会启动一个最小化的 Ubuntu 环境。
$ docker run --name some-ubuntu -i -t ubuntu
root@523c70904d54:/#
当试图直接使用 apt-get 安装一个软件的时候,会提示 E: Unable to locate package。
root@7d93de07bf76:/# apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package curl
这并非系统不支持 apt-get 命令。Docker 镜像在制作时为了精简清除了 apt 仓库信息,因此需要先执行 apt-get update 命令来更新仓库信息。更新信息后即可成功通过 apt-get 命令来安装软件。
root@7d93de07bf76:/# apt-get update
Ign http://archive.ubuntu.com trusty InRelease
Ign http://archive.ubuntu.com trusty-updates InRelease
Ign http://archive.ubuntu.com trusty-security InRelease
Ign http://archive.ubuntu.com trusty-proposed InRelease
Get:1 http://archive.ubuntu.com trusty Release.gpg [933 B]
...
首先,安装 curl 工具。
root@7d93de07bf76:/# apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
ca-certificates krb5-locales libasn1-8-heimdal libcurl3 libgssapi-krb5-2
libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
libheimntlm0-heimdal libhx509-5-heimdal libidn11 libk5crypto3 libkeyutils1
libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2
libroken18-heimdal librtmp0 libsasl2-2 libsasl2-modules libsasl2-modules-db
libwind0-heimdal openssl
...
root@7d93de07bf76:/# curl
curl: try 'curl --help' or 'curl --manual' for more information
接下来,再安装 apache 服务。
root@7d93de07bf76:/# apt-get install -y apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3
libaprutil1-ldap libxml2 sgml-base ssl-cert xml-core
...
启动这个 apache 服务,然后使用 curl 来测试本地访问。
root@7d93de07bf76:/# service apache2 start
* Starting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
*
root@7d93de07bf76:/# curl 127.0.0.1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Modified from the Debian original for Ubuntu
Last updated: 2014-03-19
See: https://launchpad.net/bugs/1288690
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apache2 Ubuntu Default Page: It works</title>
<style type="text/css" media="screen">
...
配合使用 -p 参数对外映射服务端口,可以允许容器外来访问该服务。
相关资源
Debian官网:https://www.debian.org/Neuro Debian官网:http://neuro.debian.net/Debian官方仓库:https://github.com/DebianDebian官方镜像:https://hub.docker.com/_/debian/Debian官方镜像仓库:https://github.com/tianon/docker-brew-debian/Ubuntu官网:http://www.ubuntu.org.cn/globalUbuntu官方仓库:https://github.com/ubuntuUbuntu官方镜像:https://hub.docker.com/_/ubuntu/Ubuntu官方镜像仓库:https://github.com/tianon/docker-brew-ubuntu-core
docker里安装ubuntu的更多相关文章
- docker里安装kali linux
docker里安装kali linux 官网镜像 docker search kali docker pull kalilinux/kali-linux-docker vi /etc/apt/sour ...
- LAMP(1) 在VirtualBox里安装Ubuntu Server
问题0.虚拟机中安装lamp环境 问题解决: 来自百度经验 问题1. 用putty远程登陆linux系统,显示network error connection refused 问题解决 问题2. my ...
- Linux或Docker里安装minio / Docker中安装h5ai
此文为单节点搭建操作 Linux中搭建minio 对象存储服务器 下载minio安装包 wget https://dl.minio.io/server/minio/release/linux-amd6 ...
- 在虚拟机里安装ubuntu
1.下载ubuntu镜像文件 https://mirrors.aliyun.com/ubuntu-releases/17.04/ubuntu-17.04-desktop-amd64.iso 2.创建虚 ...
- Win10 下 VMware 的安装,以及 VMware 里安装 Ubuntu 18
- 在centos docker中安装nvidia驱动
因为计算需要用到GPU加速, 今天尝试在centos 机器的Docker里安装了GTX980驱动, 记录一下详细安装过程. 首先安装Docker和镜像: sudo yum install docker ...
- 最简单的教程:在Ubuntu操作系统里安装Docker
Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相互之间不会有任何 ...
- Ubuntu 16.04+.Net Core+Docker+Uginx安装部署
前言 最近公司的项目打算移植到.Net Core平台,所以调研了一下.Net Core在Linux下的安装部署.本篇文章会一步步的描述从安装到配置到部署的全部过程.在文章的结构和内容里,笔者借鉴了很多 ...
- CentOS && Ubuntu 环境下 Docker 的安装配置
CentOS 7 install Docker Docker 支持的 centos 版本:CentOS 6.5(64-bit)或更高的版本 使用 yum 安装 1)确保 yum 包更新到最新 [roo ...
随机推荐
- 基于Linux Shell的开机启动服务
CentOS重启后,很多服务需要手动启动,很是麻烦,今天把需要开机启动或关闭的服务整理了一下,放入Linux Shell中,再将该Shell加入/etc/rc.local中,即可实现存储的自动挂载.S ...
- hiho一下 第二十九周 最小生成树三·堆优化的Prim算法【14年寒假弄了好长时间没搞懂的prim优化:prim算法+堆优化 】
题目1 : 最小生成树三·堆优化的Prim算法 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 回到两个星期之前,在成功的使用Kruscal算法解决了问题之后,小Ho产生 ...
- HDU2612 -暑假集训-搜索进阶N
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/N这两天总是因为一些小错误耽误时间,我希望自己可以细心点.珍惜 ...
- css的伪类选择器的使用
伪类选择器,在不同情况下显示的css,伪类选择器在处理页面的美观是很大帮助.其实很多美丽的按钮或者页面都是有这些基础的知识实现的,掌握好基础很重要. 名字 实例 说明 :link a:link 选择所 ...
- 英语发音规则---th
英语发音规则---th 一.总结 一句话总结: th发/ð/音的情况:a.在th后以字母-er结尾的单词中:b.在代词.冠词.介词.连词或副词中的字母组合th th发/θ/音的情况:a.在数词(包括基 ...
- node.js+express验证码的实现
安装ccap库 npm install ccap var ccap = require(); var captcha = ccap({ width:190, height:50, offset:30, ...
- Java企业微信开发_07_JSSDK多图上传
一.本节要点 1.1可信域名 所有的JS接口只能在企业微信应用的可信域名下调用(包括子域名),可在企业微信的管理后台“我的应用”里设置应用可信域名.这个域名必须要通过ICP备案,不然jssdk会配置失 ...
- 解编码框架的比较(protobuf,thrift,Marshalling,xml)
1.ProtoBuf 特点: 1.结构化数据存储格式 2.高效的解编码性能. 3.语言无关,平台无关,扩展性好. 4.官方支持java,c++,python三种语言. 5.性能比较好 (与之对比xml ...
- BEC listen and translation exercise 43
Reach for the stars so if you fall you land on a cloud.飞向星空吧,就算坠落,接住你的也是云彩. Anyway, exam failure can ...
- C#实现根据传入时间段,找出时间段内日期,并生成相对应文件路径
[1]获取固定日期范围内的所有日期,以数组形式返回 /// <summary> /// 获取固定日期范围内的所有日期,以数组形式返回 /// </summ ...