一.安装Docker(CentOS7)
1.配置yum仓库
[root@localhost ~]# wget -P /etc/yum.repos.d/ https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
2.安装docker
[root@localhost ~]# yum -y install docker
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker
[root@localhost ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-204.git0be3e21.el7.x86_64
Go version: go1.10.3
Git commit: 0be3e21/1.13.1
Built: Fri Mar 19 13:57:09 2021
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-204.git0be3e21.el7.x86_64
Go version: go1.10.3
Git commit: 0be3e21/1.13.1
Built: Fri Mar 19 13:57:09 2021
OS/Arch: linux/amd64
Experimental: false
二、Dockfile构建LNMP环境
1.构建基础镜像
[root@localhost ~]# mkdir centos
[root@localhost ~]# cd centos
[root@localhost centos]# vi Dockerfile
[root@localhost centos]# cat Dockerfile
FROM centos:centos7.9.2009
RUN yum -y install wget epel-release \
&& mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak \
&& wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/Centos-7.repo \
&& wget -P /etc/yum.repos.d/ http://mirrors.163.com/.help/CentOS7-Base-163.repo \
&& yum clean all && yum makecache
RUN yum -y install gcc gcc-c++ g