安装docker---参考https://www.cnblogs.com/nieqibest/p/9846655.html
1.$ sudo yum update
2.复制代码
$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
3.$ sudo yum install docker-engine
4.设置Docker服务开机自启 -- $ sudo systemctl enable docker.service
5.启动Docker服务 --$ sudo systemctl start docker
6.设置docker中国镜像
[root@Docker ~]# cat /etc/docker/daemon.json { "registry-mirrors":["http://18817714.m.daocloud.io"] }
systemctl daemon-reload
systemctl restart docker
7.验证Docker是否安装成功 -- sudo docker run --rm hello-world
安装docker-compose
1.sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2.sudo chmod +x /usr/local/bin/docker-compose
3.docker-compose --version
安装git -- yum install -y git
安装lnmp一键安装包
1.docker pull winstonpro/lnmp
2. docker run -d -v /home/anhao1226/default:/home/wwwroot/default -p 32801:80 -p 32802:443 -p 32803:3306 -p 32804:22 --name lnmp winstonpro/lnmp
3.docker ps 查看容器
4. docker exec -it lnmp bash 进入容器
5.docker start lnmp 重启容器
安装DNMP
clone项目:
1.$ git clone https://github.com/yeszao/dnmp.git
不是如果root用户,将还需当前用户加入docker用户组:
2.$ sudo gpasswd -a ${USER} docker
环境拷贝产品配置文件env.sample为.env,启动:
3.$ cd dnmp
4.$ cp env.sample .env # Windows系统请用copy命令,或者用编辑器打开后另存为.env
5.$ docker-compose up