Docker 创建image
zane@zane-V:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
zane0306/docker-whale latest d09756981eeb hours ago 275.1 MB
ubuntu latest 104bec311bcd days ago MB
hello-world latest c54a2cc56cbb months ago 1.848 kB
docker/whalesay latest 6b362a9f73eb months ago MB
training/webapp latest 6fae60ef3446 months ago 348.8 MB
zane@zane-V:~$ docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. [OK]
jdeathe/centos-ssh CentOS- 6.8 x86_64 / CentOS- 7.3. x8... [OK]
nimmis/java-centos This is docker images of CentOS with dif... [OK]
torusware/speedus-centos Always updated official CentOS docker imag... [OK]
egyptianbman/docker-centos-nginx-php A simple and highly configurable docker co... [OK]
nathonfowlie/centos-jre Latest CentOS image with the JRE pre-insta... [OK]
centos/mariadb55-centos7 [OK]
zane@zane-V:~$ docker pull centos
Using default tag: latest
latest: Pulling from library/centos 45a2e645736c: Pull complete
Digest: sha256:c577af3197aacedf79c5a204cd7f493c8e07ffbce7f88f7600bf19c688c38799
Status: Downloaded newer image for centos:latest
zane@zane-V:~$ docker run -t -i centos /bin/bash
[root@a57fbae352e1 /]# ls
anaconda-post.log dev home lib64 media opt root sbin sys usr
bin etc lib lost+found mnt proc run srv tmp var
zane@zane-V:~$ docker pull training/sinatra
Using default tag: latest
latest: Pulling from training/sinatra a3ed95caeb02: Pull complete
6e71c809542e: Pull complete
d196a7609355: Pull complete
08f6dff5acea: Pull complete
ce65532003d0: Pull complete
54bcaa4d1a10: Pull complete
8572ad96f6e1: Pull complete
Digest: sha256:03fc0cd265cbc28723e4efd446f9f2f37b4790cf9cc12f1b9203c79fb86b6772
Status: Downloaded newer image for training/sinatra:latest
- 更新容器,并提交更改结果到image
- 使用Dockerfile 指定说明来创建一个image
zane@zane-V:~$ docker run -t -i training/sinatra /bin/bash
root@b9d598059fa9:/#
zane@zane-V:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b9d598059fa9 training/sinatra "/bin/bash" seconds ago Up seconds desperate_bose
root@b9d598059fa9:/# apt-get install -y ruby2.-dev ruby2.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
.......
.......
root@b9d598059fa9:/# gem2. install json
Fetching: json-2.0..gem (%)
Building native extensions. This could take a while...
Successfully installed json-2.0.
Parsing documentation for json-2.0.
unable to convert "\xD0" from ASCII-8BIT to UTF- for lib/json/ext/generator.so, skipping
unable to convert "\xD0" from ASCII-8BIT to UTF- for lib/json/ext/parser.so, skipping
Installing ri documentation for json-2.0.
gem installed
root@b9d598059fa9:/# exit
exit
zane@zane-V:~$
zane@zane-V:~$ docker commit -m "Added json gem" -a "zane" b9d598059fa9 sinatra:v2
sha256:7902e96eb0144d64577348c02ff8accf939e5469c01df9a0911044122205b8c7 zane@zane-V:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sinatra v2 7902e96eb014 About a minute ago 471.2 MB
zane0306/docker-whale latest d09756981eeb hours ago 275.1 MB
centos latest 67591570dd29 days ago 191.8 MB
ubuntu latest 104bec311bcd days ago MB
hello-world latest c54a2cc56cbb months ago 1.848 kB
docker/whalesay latest 6b362a9f73eb months ago MB
training/webapp latest 6fae60ef3446 months ago 348.8 MB
training/sinatra latest 49d952a36c58 years ago MB
zane@zane-V:~$ mkdir sinatra
zane@zane-V:~$ cd sinatra/
zane@zane-V:~/sinatra$ touch Dockerfile
# This is a comment
FROM ubuntu:14.04
MAINTAINER zane zane.zhang@zoom.us
RUN apt-get update && apt-get install -y ruby ruby-dev
RUN gem install sinatra
- #: 注释
- FROM
- 以哪个image为基础
- maintainer
- 作者
- RUN
- 在基础image上做一些实质性操作
zane@zane-V:~/sinatra$ docker build -t zane/sinatra:v1 .
Sending build context to Docker daemon 2.048 kB
Step : FROM ubuntu:14.04
14.04: Pulling from library/ubuntu 16da43b30d89: Pulling fs layer
1840843dafed: Pulling fs layer
91246eb75b7d: Pulling fs layer
7faa681b41d7: Waiting
97b84c64d426: Waiting
zane@zane-V:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
zane/sinatra v1 c0e79450b1a1 About a minute ago 322.4 MB
sinatra v2 7902e96eb014 minutes ago 471.2 MB
zane0306/docker-whale latest d09756981eeb hours ago 275.1 MB
centos latest 67591570dd29 days ago 191.8 MB
ubuntu latest 104bec311bcd days ago MB
ubuntu 14.04 3f755ca42730 days ago MB
hello-world latest c54a2cc56cbb months ago 1.848 kB
docker/whalesay latest 6b362a9f73eb months ago MB
training/webapp latest 6fae60ef3446 months ago 348.8 MB
training/sinatra latest 49d952a36c58 years ago MB
zane@zane-V:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sinatra v2 7902e96eb014 minutes ago 471.2 MB
zane0306/docker-whale latest d09756981eeb hours ago 275.1 MB
centos latest 67591570dd29 days ago 191.8 MB
ubuntu latest 104bec311bcd days ago MB
ubuntu 14.04 3f755ca42730 days ago MB
hello-world latest c54a2cc56cbb months ago 1.848 kB
docker/whalesay latest 6b362a9f73eb months ago MB
training/webapp latest 6fae60ef3446 months ago 348.8 MB
training/sinatra latest 49d952a36c58 years ago MB
zane@zane-V:~$ docker tag 7902e96eb014 sinatra:vv zane@zane-V:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE B
sinatra v2 7902e96eb014 minutes ago 471.2 MB
sinatra vv 7902e96eb014 minutes ago 471.2 MB
zane0306/docker-whale latest d09756981eeb hours ago 275.1 MB
centos latest 67591570dd29 days ago 191.8 MB
ubuntu latest 104bec311bcd days ago MB
ubuntu 14.04 3f755ca42730 days ago MB
hello-world latest c54a2cc56cbb months ago 1.848 kB
docker/whalesay latest 6b362a9f73eb months ago MB
training/webapp latest 6fae60ef3446 months ago 348.8 MB
training/sinatra latest 49d952a36c58 years ago MB
zane@zane-V:~$ docker tag 7902e96eb014 zane-sinatra:vv
zane@zane-V:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sinatra v2 7902e96eb014 minutes ago 471.2 MB
sinatra vv 7902e96eb014 minutes ago 471.2 MB
zane-sinatra vv 7902e96eb014 minutes ago 471.2 MB
zane0306/docker-whale latest d09756981eeb hours ago 275.1 MB
centos latest 67591570dd29 days ago 191.8 MB
ubuntu latest 104bec311bcd days ago MB
ubuntu 14.04 3f755ca42730 days ago MB
hello-world latest c54a2cc56cbb months ago 1.848 kB
docker/whalesay latest 6b362a9f73eb months ago MB
training/webapp latest 6fae60ef3446 months ago 348.8 MB
training/sinatra latest 49d952a36c58 years ago MB
$ docker images --digests | head REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE ouruser/sinatra latest sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 5db5f8471261 hours ago 446.7 MB
zane@zane-V:~$ docker push zane/sinatra
The push refers to a repository [docker.io/zane/sinatra]
e9170f93385d: Preparing
d375b10aba64: Preparing
4fcb79d431cc: Preparing
4375cecd293e: Preparing
738d3f35b582: Preparing
53edc9780c07: Waiting
bc224b1b676d: Waiting
unauthorized: authentication required
zane@zane-V:~$ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Deleted: sha256:c54a2cc56cbb2f04003c1cd4507e118af7c0d340fe7e2720f70976c4b75237dc
Deleted: sha256:a02596fdd012f22b03af6ad7d11fa590c57507558357b079c3e8cebceb4262d7
- 寻找获取新image
- docker search centos
- 从docker hub 上pull下来
- docker pull centos
- 启动一个容器
- docker run -t -i centos /bin/bash
- 创建image两种方式
- 更新容器,并提交更改结果到image
- a.运行容器
- b.安装新软件如:ruby,python,json
- c.提交
- docker commit -m "Added json gem" -a "zane" b9d598059fa9 sinatra:v2
- -m :说明,-a:作者,
- 将容器b9d598059fa9的更改提交到sinatra 镜像的V2标签
- 使用Dockerfile,创建新image
- 编写dockerfile
- 运行build 命令
- 更新容器,并提交更改结果到image
- 给image增加标签
- docker tag 7902e96eb014 sinatra:vv
Docker 创建image的更多相关文章
- Docker创建支持ssh服务的容器和镜像
原文链接:Docker创建支持ssh服务的容器和镜像 1. 这里使用的centos作为容器,所以首先下载centos的images # sudo docker pull centos 2. 下载后执行 ...
- Docker创建MySQL集装箱
原文链接:Docker创建MySQL集装箱 这样做的目的是创建一个MySQL的image,出来的容器里自己主动启动MySQL服务接受外部连接 步骤: 1. 首先创建一个文件夹并在文件夹下创建一个Doc ...
- Docker 创建 Crucible4.6.1 以及与 Crowd3.3.2 实现 SSO 单点登录
目录 目录 1.介绍 1.1.什么是 Crucible? 2.Crucible 的官网在哪里? 3.如何下载安装? 4.对 Crucible 进行配置 4.1.破解 Crucible 第一步 4.2. ...
- Docker 创建 Crowd3.3.2 以及打通 Jira Software7.12.3和Confluence6.12.2 SSO 单点登录
目录 目录 1.介绍 1.1.什么是Crowd? 2.Crowd 的官网在哪里? 3.如何下载安装? 4.对 Crowd 进行配置 4.1.破解 Crowd 第一步 4.2.破解 Crowd 第二步, ...
- Docker 创建 Bamboo6.7.1 以及与 Crowd3.3.2 实现 SSO 单点登录
目录 目录 1.介绍 1.1.什么是 Bamboo? 2.Bamboo 的官网在哪里? 3.如何下载安装? 4.对 Bamboo 进行配置 4.1.获取授权许可 4.2.一般配置 4.3.数据库配置 ...
- Docker 创建 Jira Core(Jira SoftWare) 7.12.3 中文版
目录 目录 1.介绍 1.1.什么是 JIRA Core? 1.2.什么是 JIRA SoftWare 2.JIRA 的官网在哪里? 3.如何下载安装? 4.对 JIRA 进行配置 4.1.JIRA ...
- Docker 创建 Confluence6.12.2 中文版
目录 目录 1.介绍 1.1.什么是Confluence? 2.Confluence的官网在哪里? 3.如何下载安装? 4.对 Confluence 进行配置 4.1.设置 Confluence 4. ...
- Docker创建JIRA 7.2.4中文破解版
目录 目录 1.介绍 1.1.什么是JIRA? 2.JIRA的官网在哪里? 3.如何下载安装? 4.对JIRA进行配置 4.1.打开浏览器:http://localhost:20012 4.2.JIR ...
- Docker 创建容器 查看容器状态 - 三
Docker 创建容器 1.拉取镜像 默认是 docker.io 仓最新镜像 docker pull tomcat 2.运行一个服务容器 docker run -d -p 0.0.0.0:18080: ...
- 使用 docker 创建自己的镜像
docker run 命令 镜像(image):An image is a filesystem and parameters to use at runtime. It doesn't have s ...
随机推荐
- windows下git安装以及基本配置
一.首先要下载git然后进行默认安装即可,然后查看系统环境变量是否添加 二.桌面右击鼠标,选择git bash 进入操作页面 git --version 检测是否安装成功 安装完成有配置一 ...
- 友推在Android 实现微信等分享代码的常见问题
介绍,最近 做了一个项目,需要集成分享功能.果断选择 友推. 集成过程,参考友推官方提供的集成文档即可 废话不多说,主要说一下自己在集成过程中遇到的一些问题,主要有两个: 问题1. 引入youtui- ...
- Robotium测试架构规划及测试用例组织
转自:http://blog.sina.com.cn/s/blog_68f262210102vrft.html 6.1 测试架构规划 由于测试用例执行的时候是在手机上执行的,所以类似于Web的把测试数 ...
- 菜鸟之路——git学习及GitHub的使用
首先,感谢廖雪峰老师的git教程 https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 ...
- [HTTPS]pfx转jks
keytool -importkeystore -srckeystore src.pfx -srcstoretype pkcs12 -destkeystore trg.jks -deststoret ...
- [ecmagnet][python基础]有关git那些事
#1 git教程 # 注册git服务器用户,权限-- 注意这个和客户端用户不是一样 # 客户端(linux)提交代码到本地仓库(简单版,了解原理) a.安装git sudo apt-get insta ...
- 【转】UGUI VS NGUI
原文:http://gad.qq.com/college/articledetail/7191053 注[1]:该比较是基于15年-16年期间使用NGUI(3.8.0版本)与UGUI(4.6.9版本) ...
- 【翻译】Apache软件基金会1
最近有点看不进去书,所以就找点东西翻译下,正好很想了解Apache基金会都有什么开源项目,每天找点事时间翻译翻译,还可以扩展下视野. 今天就看了两个,第一个是关于.NET的,不再兴趣范围内.第二个还挺 ...
- C 语言实现 php base64_encode
这是在网上找到的一段代码,因为需求不同,稍微做了下修改,有需要的朋友可以直接复制使用. unsigned char *base64_encode(const unsigned char *str, s ...
- Hadoop体系所有组件默认端口列表
Why? Hadoop集群组件太多,默认端口无法记住,有事后需要查看,就在这里罗列下这里包含我们使用到的组件:HDFS, YARN, Hbase, Hive, ZooKeeper。 What? 端口 ...