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 ...
随机推荐
- Linux之如何进行固定IP、DNS等设置
前提:虚拟机Linux centOS6.6 Linux如何设置固定IP.dns.网关 1.切换到root账号 2.#cd /etc/sysconfig/network-scripts 进入网卡的设置 ...
- Ubuntu18.04安装docker、docker-compose、
Ubuntu18.04下Docker CE安装 Docker版本分为两个:Docker Community Edition (CE)和 Docker Enterprise Edition (EE).D ...
- 聊聊、RabbitMQ 第一篇
(一)windows 下安装配置 开源的消息中间件有很多,各有各的优缺点,适合自己项目的才是最好的.首先下载 rabbitMQ 安装版本,因为 rabbitMQ 底层语言是 erlang,所以首先要先 ...
- schema.xml属性概念
# schema 定义逻辑库 checkSQLschema 当该值设置为 true 时,如果我们执行语句**select * from TESTDB.travelrecord;**则 MyCat 会 ...
- Could not connect to Redis at 127.0.0.1:6379: Connection refused
启动redis: redis-server ../redis.conf redis启动成功后 执行命令行redis-cli报:Could not connect to Redis at 127.0. ...
- ZigBee学习五 无线温度检测
ZigBee学习五 无线温度检测 1)修改公用头文件GenericApp.h typedef union h{ uint8 TEMP[4]; struct RFRXBUF { unsigned cha ...
- PHP网站提交表单如何实现验证码验证功能
很多小伙伴在原生网站时候都会遇到很多意料之外的情况发生,也有不少小伙伴在初学程序代码的时候可能会因为一个小小的逗号隐藏在几百行,几千行的代码中出错常见的在提交表单中很多事需要验证码验证,那么如何来实现 ...
- CSA Round #84 The Sprawl
题目 Analysis 曼哈顿距离($L1$ metric)最小生成树. Implementation 下面的代码参考了 gispzjz 在比赛中的提交. #include <bits/stdc ...
- hdu 3874 树状数组
思路:和求区间内有多少个不同的数一样,只不过改下权值. #include<iostream> #include<cstdio> #include<algorithm> ...
- Ubuntu 查看默认软件安装位置
tags: Linux 方法 1:在命令行输入:dpkg -L 软件包名: 方法 2:在/var/cache/apt/archives找的你安装程序的包,然后用gdebi-gtk+软件包名可以查看具体 ...