Docker_学习笔记系列之CentOs7安装docker

1.基本的Linux环境配置

# 关闭selinux防火墙sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/configsync && reboot# 配置网络vim /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0  # 指定网卡标识BOOTPROTO=none # static /dhcp 指定网络模式,静态还是动态的ONBOOT=yes   # 开机自动启动网卡IPADDR=192.168.1.2GATEWAY=192.168.1.1NETMASK=255.255.255.0systemctl restart network# 配置yum源mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bakcurl  -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo  # -o 下载重命名yum clean all && yum makecache# 配置eprl库,第三方软件nginx,apache,pip等需要yum install epel-release# 安装常用Linux管理工具安装vim,wget【-O 下载】lrzsz【文件上传下载】tree【目录树】provides pstree【进程树】bash-completion【命令补全】bink-utils【nolookup】tcpdump【抓包】net-tools【网络命令工具ifconfig,netstat】yum install -y vim lrzsz provides pstree tree bash-completion bink-utils tcpdump net-tools

2.卸载旧版本docker

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

3.设置存储仓库

sudo yum install -y yum-utils device-mapper-persistent-data lvm2sudo yum-config-manager  --add-repo   https://download.docker.com/linux/centos/docker-ce.repo

4.安装docker引擎【社区版】

sudo yum install docker-ce

5.管理docker

# 启动systemctl start docker# 测试是否安装成功,通过启动一个容器sudo docker run hello-world

6.配置docker镜像加速器【/etc/docker/daemon.json】

# 官网:https://docs.docker.com/install/linux/docker-ce/centos/#upgrade-docker-after-using-the-convenience-scriptcurl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

官方文档:https://docs.docker.com/install/linux/docker-ce/centos/#upgrade-docker-after-using-the-convenience-script

©著作权归作者所有:来自51CTO博客作者mob604756e88498的原创作品,如需转载,请注明出处,否则将追究法律责任