2.Docker的安装

前提条件:
    docker运行在centios7上,要求系统64位,系统内行人版本在3.10以上
    docker运行在centios6.5或者更高的版本,要求系统为64为,系统内核版本为2.6.32-431或者更高的版本
    
查看自己的系统内核:
    6.5版本:命令:uname -r
    7.0版本:cat /etc/redhat-release
Docker的架构图:
docker的三大要素:
    Person p1=new Person();
    Person p2=new Person();
    Person p3=new Person();
    以上述的java实例化作为示例说明:
    
    1.镜像
        Docker镜像( Image)就是一个只读的模板, 镜像可以用来创建docker容器, 一个镜像可以创建多个容器:
        镜像就类比Person这个类
        
    2.容器
        docer利用容器(Container)独立运行的一个或者一组应用。容器时利用镜像创建的运行实例
        它可以启动,开始,停止,删除。每个容器都是相互隔离的,保证安全的平台
        可以当作是一个简易版的linux环境
        容器就是上述的p1,p2,p3的对象
        
    3.仓库
        集中存放镜像的地方
        仓库(Repository)和仓库服务器(Registry)是有区别的。仓库注册服务器上往往放着多个仓库,每个仓库中又包含了多个镜像,每个镜像都有不同的标签(tag)
        国内使用的公开仓库又:阿里云,网易云等

centios7 安装docker:https://blog.csdn.net/u014069688/article/details/100532774
必须能连接外网
安装完成后还需要给docker安装阿里云镜像加速:
    需要注册阿里云账号:
    自己的账号:15389216783
    密码:常规密码
    1.https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

执行测试命令:docker run hello-world(镜像)
[root@wmd03 ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:4cf9c47f86df71d48364001ede3a4fcd85ae80ce02ebad74156906caff5378bc
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
当执行docker run时的逻辑
1.为什么docker的加载速度块

posted @ 2022-05-26 20:00  努力的达子  阅读(34)  评论(0编辑  收藏  举报