forked from yeasy/docker_practice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor change to expression; unify the term and formatting
- Loading branch information
Showing
6 changed files
with
15 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# 基本概念 | ||
Docker包括三个基本概念 | ||
* 镜像(Image) | ||
* 容器(Container) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
##镜像的实现原理 | ||
## 镜像的实现原理 | ||
|
||
Docker镜像是怎么实现增量的修改和维护的? | ||
每个docker都有很多层次构成,docker使用 [Union FS](http://en.wikipedia.org/wiki/UnionFS) 将这些不同的层结合到一个镜像中去。 | ||
每个镜像都由很多层次构成,Docker使用 [Union FS](http://en.wikipedia.org/wiki/UnionFS) 将这些不同的层结合到一个镜像中去。 | ||
|
||
通常 Union FS 有两个用途, 一方面可以实现不借助 LVM、RAID 将多个disk挂到同一个目录下, 另一个更常用的就是将一个只读的分支和一个可写的 分支联合在一起,Live CD正是基于此方法可以允许在 OS 镜像不变的基础上允许用户在其上进行一些写操作。 | ||
Docker 在 AUFS 上构建的容器也正是如此。 | ||
通常Union FS有两个用途, 一方面可以实现不借助 LVM、RAID 将多个disk挂到同一个目录下,另一个更常用的就是将一个只读的分支和一个可写的分支联合在一起,Live CD正是基于此方法可以允许在镜像不变的基础上允许用户在其上进行一些写操作。 | ||
Docker在AUFS上构建的容器也是利用了类似的原理。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
##移除本地镜像 | ||
## 移除本地镜像 | ||
如果要移除本地的镜像,可以使用`docker rmi`命令。注意`docker rm`命令是移除容器。 | ||
``` | ||
$ sudo docker rmi training/sinatra | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
##存出和载入镜像 | ||
## 存出和载入镜像 | ||
|
||
###存出镜像 | ||
### 存出镜像 | ||
如果要导出镜像到本地文件,可以使用`docker save`命令。 | ||
``` | ||
$sudo docker images | ||
$ sudo docker images | ||
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE | ||
ubuntu latest 826544226fdc 2 weeks ago 194.2 MB | ||
ouruser/sinatra v2 51619aaca804 2 weeks ago 373.3 MB | ||
ubuntu 14.04 c4ff7513909d 5 weeks ago 225.4 MB | ||
... | ||
$sudo docker save -o ubuntu_14.04.tar ubuntu:14.04 | ||
``` | ||
|
||
|
||
###载入镜像 | ||
### 载入镜像 | ||
可以使用`docker load`从导出的本地文件中再导入到本地镜像库,例如 | ||
``` | ||
$sudo docker load --input ubuntu_14.04.tar | ||
$ sudo docker load --input ubuntu_14.04.tar | ||
``` | ||
或 | ||
``` | ||
$sudo docker load < ubuntu_14.04.tar | ||
$ sudo docker load < ubuntu_14.04.tar | ||
``` | ||
这将导入镜像以及其相关的元数据信息(包括标签等)。 |