4-Docker命令之docker import

1.docker import介绍

docker import命令是用于使用docker export命令从docker容器导出的归档文件中创建镜像。即docker import命令相对应的命令为docker export

2.docker import用法

docker import [参数] file|URL|- [REPOSITORY[:TAG]]

[root@centos79 ~]# docker import --help

Usage:  docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]

Import the contents from a tarball to create a filesystem image

Aliases:
  docker image import, docker import

Options:
  -c, --change list       Apply Dockerfile instruction to the created image
  -m, --message string    Set commit message for imported image
      --platform string   Set platform if server is multi-platform capable
[root@centos79 ~]# 

3.实例

3.1.使用归档文件创建镜像

命令:

docker import ztj-running.tar centos7-ztj:1.0

[root@centos79 ~]# ls -l ztj-running.tar 
-rw------- 1 root root 211688960 11月 24 14:27 ztj-running.tar
[root@centos79 ~]# docker import ztj-running.tar centos

猜你喜欢

转载自blog.csdn.net/z19861216/article/details/134598622