docker_practice/container/import_export.md

33 lines
1.5 KiB
Go
Raw Normal View History

2017-11-22 11:22:57 +08:00
##
2017-11-22 11:22:57 +08:00
###
使 `docker export`
2017-11-13 18:54:38 +08:00
```bash
$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2018-12-19 17:24:52 +08:00
7691a814370e ubuntu:18.04 "/bin/bash" 36 hours ago Exited (0) 21 hours ago test
2017-11-13 18:54:38 +08:00
$ docker export 7691a814370e > ubuntu.tar
```
2017-11-22 11:22:57 +08:00
###
使 `docker import`
2017-11-13 18:54:38 +08:00
```bash
$ cat ubuntu.tar | docker import - test/ubuntu:v1.0
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
test/ubuntu v1.0 9d37a6082e97 About a minute ago 171.3 MB
```
URL
2017-11-13 18:54:38 +08:00
```bash
$ docker import http://example.com/exampleimage.tgz example/imagerepo
```
*使 `docker load` 使 `docker import` *