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 ...
随机推荐
- C#定时器,定时做什么事情
http://www.cnblogs.com/bobositlife/archive/2015/09/29/aspnet-mvc-csharp-quartz-net-timer-task-schedu ...
- 【Two Sum】cpp
题目: Given an array of integers, find two numbers such that they add up to a specific target number. ...
- MFC深入浅出读书笔记第一部分
最近看侯捷的MFC深入浅出,简单总结一下. 第一章首先就是先了解一下windows程序设计的基础知识,包括win32程序开发基础,什么*.lib,*.h,*.cpp的,程序入口点WinMain函数,窗 ...
- c4d 帮助 prime r16 usage
c4d 帮助 prime cinema 4d prime c4d 基础 前言 usage 开始 双击程序图标 双击一个场景文件 用开始菜单 windows 二选一 从 ...
- hnust Snowman
问题 D: Snowman 时间限制: 1 Sec 内存限制: 128 MB提交: 203 解决: 94[提交][状态][讨论版] 题目描述 前言:这是某比赛的热身题,本题主要考察英文水平,只要看 ...
- Html语言的标签讲解
一.head头部中的内容: 1.<meta charset="UTF-8"> <--!告诉浏览器什么编码--> 2.<meta http-equiv= ...
- [HTTPS]pfx转jks
keytool -importkeystore -srckeystore src.pfx -srcstoretype pkcs12 -destkeystore trg.jks -deststoret ...
- Android版本对应的API号
Android版本 API 级别 1.5 API 3 1.6 API 4 2.1 API 7 2.2 API 8 2.3.3 API 10 3.0 API 11 3.1 API 12 3.2 API ...
- linux开机关机自启动或自关闭服务的方式
背景 由于迁移部门jira和confluence到linux,需要设置这两个服务在开机或关机时能够自动启动或关闭.这里我就拿配置confluence过程来记录. 方式1:chkconfig 特点:ch ...
- selenium webdriver——鼠标事件
Web产品中提供了丰富的鼠标交互方式,例如鼠标右击.双击.悬停.甚至是鼠标拖动等功能,在WebDriver中,将这些关于鼠标操作的方法 封装在ActionChains类中: ActionChains类 ...