==========安装软件==========
yum install –y docker ##默认安装
先配置阿里云镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://r63r5o6g.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
#拉取镜像
docker pull mysql:5.7
#目录挂载,并且设置mysql初始密码
docker run -p 9900:3306 --name docker-mysql -v /root/docker/mysql57/conf:/etc/mysql/conf.d -v /root/docker/mysql57/logs:/logs -v /root/docker/mysql57/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=tianhh@123 -d mysql:5.7
# reids 安装
docker pull redis
#目录挂载,并且设置redis连接密码
docker run -p 9901:6379 --name redis -v /root/docker/redis/redis.conf:/etc/redis/redis.conf -v /root/docker/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes --requirepass "tianhh@123"
# 安装tomcat 没用到
docker run -p 18080:8080 -p 16002:16002 --name docker-tomcat8 -e JAVA_OPTS="-Duser.timezone=Asia/Shanghai" -v /root/docker/tomcat/webapp:/usr/local/tomcat/webapps -v /root/docker/tomcat/logs:/usr/local/tomcat/logs -v /etc/localtime:/etc/localtime -d tomcat:8
# 安装nginx
docker pull nginx:1.14.2
docker run --name nginx --network=host -d -p 80:80 -v /root/docker/nginx/nginx.conf:/etc/nginx/nginx.conf -v /root/docker/nginx/html:/etc/nginx/html -v /root/docker/nginx/logs:/var/log/nginx nginx:1.14.2
=========================
==========springboot项目制作镜像==========
https://www.jianshu.com/p/397929dbc27d
docker build -t tianqing-admin .
docker run -d -p 8080:9999 -v /root/docker/tianqing-admin/logs:/logs tianqing-admin
docker build -t tianqing-file .
docker run -d -p 8082:8081 -v /root/docker/tianqing-file/logs:/logs -v /root/docker/tianqing-file/TqAdmin:/TqAdmin tianqing-file
docker build -t tianqing-nongchang .
docker run -d -p 8081:5555 -v /root/docker/tianqing-nongchang/logs:/logs tianqing-nongchang
docker inspect 5667bb4ad256| grep IPAddress
=========================
==========地址==========
后台:http://nongchang.jzddyr.com/admin/login.html
前台:http://nongchang.jzddyr.com/weixin/home.html
=========================
发表评论: