This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
basic/hello-world | ||
basic/docker-hub使用 | ||
basic/[Ubuntu 16.04]docker启动设置 | ||
basic/[docker commit]保存容器为镜像 |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
# [docker commit]保存容器为镜像 | ||
|
||
保存已修改后的容器为新的镜像 | ||
|
||
## 语法 | ||
|
||
``` | ||
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] | ||
``` | ||
|
||
* 参数`CONTAINER`指定容器`ID` | ||
* 参数`REPOSITORY`指定新的镜像名,格式为 | ||
* 参数`TAG`指定额外标记,比如版本号 | ||
|
||
可添加额外选项,指定作者名,提交信息,是否在提交时暂停容器以及是否应用`Dockerfile`指令到创建的镜像 | ||
|
||
![](./imgs/commit-options.png) | ||
|
||
## 示例 | ||
|
||
``` | ||
$ docker commit --author zjzstu --message "using aliyun mirrors" f8f8 zjzstu/ubuntu:18.04 | ||
sha256:5493327e7708602f5ebb0b42d638234bf47ff4ee23804d3b3a96535d4c8dcec3 | ||
$ docker image ls | ||
REPOSITORY TAG IMAGE ID CREATED SIZE | ||
zjzstu/ubuntu 18.04 5493327e7708 19 seconds ago 109MB | ||
``` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.