编辑: 旋风 2013-04-26

使用 curl 命 令访问 get.docker.com 网站.后者将获得一个安装脚本,该脚本将通 过 yum 管理器安装Docker. 使用yum安装 1. 登录系统,并确认用户为 root 或者用户有权限使用 sudo 命令. C01S01 在CentOS7上使用二进制包安装

5 2. 保证你现有的yum安装包是最新的. $ sudo yum update 1. 添加yum repo $ sudo tee /etc/yum.repos.d/docker.repo fb434121fc77 再次, docker执行下一步操作,使用 apt-get 更新包管理器.这里显示了很多行 内容,没必要全部列出来. Step

2 : RUN apt-get -y update &

&

apt-get install -y fortunes --->

Running in 27d224dfa5b2 Ign http://archive.ubuntu.com trusty InRelease Ign http://archive.ubuntu.com trusty-updates InRelease Ign http://archive.ubuntu.com trusty-security InRelease Hit http://archive.ubuntu.com trusty Release.gpg ....snip... Get:15 http://archive.ubuntu.com trusty-security/restricted amd6

4 Packages [14.8 kB] Get:16 http://archive.ubuntu.com trusty-security/universe amd64 Packages [134 kB] Reading package lists... --->

eb06e47a01d2 再次, docker开始安装 fortune 软件. C02S03 创建自定义镜像

36 Removing intermediate container e2a84b5f390f Step

3 : RUN apt-get install -y fortunes --->

Running in 23aa52c1897c Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: fortune-mod fortunes-min librecode0 Suggested packages: x11-utils bsdmainutils The following NEW packages will be installed: fortune-mod fortunes fortunes-min librecode0

0 upgraded,

4 newly installed,

0 to remove and

3 not upgraded. Need to get

1961 kB of archives. After this operation,

4817 kB of additional disk space will be u sed. Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main librecode0 a md64 3.6-21 [771 kB] ...snip...... Setting up fortunes (1:1.99.1-7) ... Processing triggers for libc-bin (2.19-0ubuntu6.6) ... --->

c81071adeeb5 Removing intermediate container 23aa52c1897c 最后, 完成安装并报告结果 Step

4 : CMD /usr/games/fortune -a | cowsay --->

Running in a8e6faa88df3 --->

7d9495d03763 Removing intermediate container a8e6faa88df3 Successfully built 7d9495d03763 Step 04: 启动你的docker-whale镜像 本节中,你将在本机确认你所创建的镜像,并启动他. C02S03 创建自定义镜像

37 1. 打开命令行交互窗口 2. 使用命令 docker images 查看镜像列表 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker-whale latest 7d9495d03763

4 minutes ag o 273.7 MB docker/whalesay latest fb434121fc77

4 hours ago

247 MB hello-world latest 91c95931e552

5 weeks ago

910 B 1. 使用命令 docker run docker-whale 启动你的镜像 $ docker run docker-whale / He was a modest, good-humored boy. It \ \ was Oxford that made him insufferable. / o 正如你所见到的,你创建的鲸鱼更聪明.不仅自己会说话,而且命令更简单!你可 能已经知道了,docker并没有下载任何东西,主要是因为本地已经包含了该镜像且 能正常使用. C02S03 创建自定义镜像

38 C02S03 创建自定义镜像

39 使用commit提交容器创建镜像 2016-09-26 octowhale#github dockerfile是告诉docker按照步骤从基本镜像构建新镜像. commit则是自己手动从 基本镜像完善容器,并将容器转换为镜像. 获取镜像母版 1. 确认docker已经运行 2. 下载基本镜像 $ docker pull centos Using default tag: latest latest: Pulling from library/centos Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac82868 84f6cf59373ed9b Status: Image is up to date for centos:latest 创建自定义系统环境 1. ........

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题