docker_practice/image/other.md

85 lines
3.4 KiB
Go
Raw Normal View History

2017-12-20 15:44:47 +00:00
##
使 `Dockerfile`
### rootfs
`docker import [选项] <文件>|<URL>|- [<仓库名>[:<标签>]]`
Web `/`
2018-12-19 09:24:52 +00:00
[OpenVZ](https://openvz.org) 的 Ubuntu 14.04 [模板](https://openvz.org/Download/template/precreated)的镜像:
```bash
$ docker import \
http://download.openvz.org/template/precreated/ubuntu-14.04-x86_64-minimal.tar.gz \
openvz/ubuntu:14.04
Downloading from http://download.openvz.org/template/precreated/ubuntu-14.04-x86_64-minimal.tar.gz
sha256:f477a6e18e989839d25223f301ef738b69621c4877600ae6467c4e5289822a79B/78.42 MB
```
`ubuntu-14.04-x86_64-minimal.tar.gz` `openvz/ubuntu:14.04`
`docker image ls`
```bash
$ docker image ls openvz/ubuntu
REPOSITORY TAG IMAGE ID CREATED SIZE
openvz/ubuntu 14.04 f477a6e18e98 55 seconds ago 214.9 MB
```
```bash
$ docker history openvz/ubuntu:14.04
IMAGE CREATED CREATED BY SIZE COMMENT
f477a6e18e98 About a minute ago 214.9 MB Imported from http://download.openvz.org/template/precreated/ubuntu-14.04-x86_64-minimal.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'
```