docker--环境搭建

    我的电脑是win10,虽然现在win10开始也支持docker,但在linux机器会合适些,所以我先用VMware创建一个linux虚拟机--Centos7

安装虚拟机不多说,现在开始安装docker

1、删除docker(如果有的话)

yum remove docker 
                  docker-client 
                  docker-client-latest 
                  docker-common 
                  docker-latest 
                  docker-latest-logrotate 
                  docker-logrotate 
                  docker-selinux 
                  docker-engine-selinux 
                  docker-engine

2、安装一些系统必要的工具

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

3、获取docker的yum源

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

4、更新yum缓存

yum makecache fast

5、安装docker

yum -y install docker-ce

6、启动docker

systemctl start docker

7、测试运行

docker run hello-world

8、由于是学习用,所以我还安装一些工具

yum install -y git vim gcc glibc-static telnet bridge-utils net-tools

9、查看本地拥有的image,hello world是第七步运行image时下载的。

[root@localhost ~]# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        6 months ago        1.84kB
[root@localhost ~]# 

image说明如下,bootfs是内核,在上面有不同的base image,也就是各种发行版,Centos、Ubuntu、Debian等,在base image上可以安装软件(eg apache)构成新的image#2,在image#2上安装mysql可以构成新的image#4,

image#4 和image2可以共享相同的layer,也就是base image。

原文地址:https://www.cnblogs.com/laonicc/p/11141779.html