yum update
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
yum install docker-ce 

加入启动

systemctl start docker
systemctl enable docker

验证安装完成

docker version

 镜像安装目录

/var/lib/docker/image/ 

 

安装openresty

docker pull openresty/openresty

#-v参数,冒号前为宿主机目录,必须为绝对路径,冒号后为镜像内挂载的路径;指定为只读可以用:ro
docker run -d --name="nginx" -p 8080:80 -p 80:80 -p 8011:8011 -p 443:443 -v /data/openresty/nginx/conf/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro -v /data/openresty/nginx/logs:/usr/local/openresty/nginx/logs openresty/openresty

docker kill nginx && docker rm nginx

  docker ps

 docker exec -it [docker名字] nginx -t
  docker exec -it nginx nginx -s reload

 

docker ps

docker stop dc

docker kill dc && docker rm dc


 docker run -d --restart=always -t -i --name dc -p 172.24.150.152:17080:8080 -m 4g -v /data/logs/dc:/data/logs -v /data/logs/dc:/data/log -v /data/logs/dc/tomcat:/data/logs/tomcat -v /data/app/dc:/data/app/dc:ro -v /data/app/dc/web-home/target/dc-web-home.war:/data/war/ROOT.war:ro docker.xsj.qinha.com/xinip/tomcat8:war

 docker run -d --restart=always -t -i --name dc -e APP_MODE=prod -p 172.24.150.152:17080:8080 -m 4g -v /data/logs/dc:/data/logs -v /data/logs/dc:/data/log -v /data/logs/dc/tomcat:/data/logs/tomcat -v /data/app/dc:/data/app/dc:ro -v /data/app/dc/web-home/target/dc-web-home.war:/data/war/ROOT.war:ro docker.xsj.qinha.com/xinip/tomcat8:war

 

posted on 2018-12-14 17:03  凌度  阅读(202)  评论(0编辑  收藏  举报