docker 配置nginx和myslq


nginx

docker run -p 8080:80 --name nginx --restart=always \
-v /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /opt/nginx/conf.d:/etc/nginx/conf.d \
-v /opt/nginx/html:/usr/share/nginx/html \
-v /opt/nginx/logs:/var/log/nginx \
-d  nginx

或者

docker run \
--name my_nginx \
-v /opt/nginx/log:/var/log/nginx  \
-v /opt/nginx/html:/usr/share/nginx/html \
-v /opt/nginx/conf.d:/etc/nginx/conf.d  \
-d nginx

mysql

docker run \
--restart=always \
-p 8306:3306 --name mysql \
-v /data/data_mate/download/mysql/conf:/etc/mysql/conf \
-v /data/data_mate/download/mysql/logs:/logs \
-v /data/data_mate/download/mysql/data:/var/lib/mysql \
-e "MYSQL_ROOT_PASSWORD=*********" \
-d mysql:8.0.28