docker_practice/image/other.md

86 lines
3.3 KiB
Go
Raw Normal View History

#
使 `Dockerfile`
## rootfs
`docker import [选项] <文件>|<URL>|- [<仓库名>[:<标签>]]`
Web `/`
[OpenVZ](https://openvz.org) 的 Ubuntu 16.04 [模板](https://wiki.openvz.org/Download/template/precreated)的镜像:
```bash
$ docker import \
2019-04-29 09:26:29 +08:00
http://download.openvz.org/template/precreated/ubuntu-16.04-x86_64.tar.gz \
openvz/ubuntu:16.04
Downloading from http://download.openvz.org/template/precreated/ubuntu-16.04-x86_64.tar.gz
sha256:412b8fc3e3f786dca0197834a698932b9c51b69bd8cf49e100c35d38c9879213
```
2019-04-29 09:26:29 +08:00
`ubuntu-16.04-x86_64.tar.gz` `openvz/ubuntu:16.04`
`docker image ls`
```bash
$ docker image ls openvz/ubuntu
REPOSITORY TAG IMAGE ID CREATED SIZE
2019-04-29 09:26:29 +08:00
openvz/ubuntu 16.04 412b8fc3e3f7 55 seconds ago 505MB
```
```bash
2019-04-29 09:26:29 +08:00
$ docker history openvz/ubuntu:16.04
IMAGE CREATED CREATED BY SIZE COMMENT
2019-04-29 09:26:29 +08:00
f477a6e18e98 About a minute ago 214.9 MB Imported from http://download.openvz.org/template/precreated/ubuntu-16.04-x86_64.tar.gz
```
## `docker save` `docker load`
Docker `docker save` `docker load` Docker Registry 使 Docker Registry使 Docker Hub 使 Registry
###
使 `docker save`
`alpine`
```bash
$ docker image ls alpine
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine latest baa5d63471ea 5 weeks ago 4.803 MB
```
```bash
$ docker save alpine -o filename
$ file filename
filename: POSIX tar archive
```
filename
****
使 `gzip`
```bash
$ docker save alpine | gzip > alpine-latest.tar.gz
```
`alpine-latest.tar.gz`
```bash
$ docker load -i alpine-latest.tar.gz
Loaded image: alpine:latest
```
`ssh` `pv` Linux
```bash
docker save <> | bzip2 | pv | ssh <>@<> 'cat | docker load'
```