镜像上传、存入、存出

首先得去https://www.docker.com/  官网注册一个账号


1.上传镜像

[root@localhost docker]# docker tag test:latest dy1999/test:latest

[root@localhost docker]# docker login  输入刚才注册的用户名和密码

Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.

Username: dy1999

Password: 

Login Succeeded

[root@localhost docker]# docker push dy1999/test:latest   其中dy1999为我刚注册的用户名  test为docker网站上的仓库名 没有会自动创建  latest为标签

The push refers to a repository [docker.io/dy1999/test]

a473a4bafa40: Pushed 

a8de0e025d94: Pushed 

a5e66470b281: Pushed 

ac7299292f8b: Pushed 

e1a9a6284d0d: Pushed 

fccbfa2912f0: Pushed 

latest: digest: sha256:3545bfcb3fd004ce0c3489a5f10dbbf92187ea2cb89c0aaf6e5c3946981b263f size: 1564



2.存出

​https://openvz.org/Download/template/precreated 下载ubuntu-14.04-x86_64-minimal.tar.gz

cd  /var/opt/docker   上传文件 ubuntu-14.04-x86_64-minimal.tar.gz

[root@localhost docker]# sudo cat ubuntu-14.04-x86_64-minimal.tar.gz |docker import - ubuntu:14.04

会输出sha256:cd7ac3dace3edc17b80b933a2c43976be0068c83fb749d8fc7a559a04f43dcdf


[root@localhost docker]# docker images

REPOSITORY                 TAG                 IMAGE ID            CREATED              SIZE

ubuntu                     14.04               cd7ac3dace3e        About a minute ago   215 MB

test                       latest              131466eb2ab0        23 minutes ago       113 MB

docker.io/ubuntu           latest              c9d990395902        4 days ago           113 MB

docker.io/centos           latest              e934aafc2206        10 days ago          199 MB

docker.io/learn/tutorial   latest              a7876479f1aa        5 years ago          128 MB

存出本地的镜像为文件ubuntu_14.04.tar

[root@localhost docker]# docker save -o ubuntu_14.04.tar  ubuntu:14.04  

会 在/var/opt/docker 创建ubuntu_14.04.tar文件



3.存入

docker load --input ubuntu_14.04.tar 载入镜像

或者docker load < ubuntu_14.04.tar


[root@localhost docker]# docker load < ubuntu_14.04.tar

输出Loaded image: ubuntu:14.04


你可能感兴趣的:(javaEE)