docker deploy PHP project

The deployment is designed to use on a single server docker build relevant environmental, and run PHP project

System: CentOS7 +

Installation docker environment

  • First yum update
$ sudo yum update
  • Docker remove the old version (if any)
$ 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
  • Installation System dependence
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  • Add information source software
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  • Yum update cache
sudo yum makecache fast
  • Installation docker-ce
sudo yum -y install docker-ce
  • Start docker background service
sudo systemctl start docker
  • Hello-world test run
[root@runoob ~]# docker run hello-world
     docker  run 命令会先在本地查找 hello-world镜像,如果本地没有会自动下载一个到本地,然后在运行hello-world

  • Delete docker-ce (If you want to uninstall docker can execute the following command)
$ sudo yum remove docker-ce
$ sudo rm -rf /var/lib/docker
  • Now that we have docker environment, we use the following docker build Nginx and PHP, database on, we still use the previous database server,

Guess you like

Origin www.cnblogs.com/lz0925/p/10985700.html