创建mysql容器,设置端口映射,目录映射
docker run -id \ -p 3306:3306 \ --name=mysql \ -v $PWD/conf:/etc/mysql/conf.d \ -v $PWD/logs:/logs \ -v $PWD/data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=111111 \ mysql:5.7
创建tomcat容器,设置端口映射,目录映射
mkdir tomcat cd tomcat docker run -id \ -p 8080:8080 \ -v $PWD:/user/local/tomcat/webapps \ tomcat
创建nginx容器
mkdir nginx cd nginx touch nginx.conf #nginx.conf内容 mkdir conf mkdir logs mkdir html docker run -it --name=nginx \ -p 80:80 \ -v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf \ -v $PWD/logs:/var/log/nginx \ -v $PWD/html:/usr/share/nginx/html \ nginx
创建redis容器
docker run -id --name=redis -p 6379:6379 redis:latest ./redis-cli.exe -h xxxxx -p 6379 #带密码 docker run -id --name redis -p 6379:6379 redis:latest --requirepass "adam1111"
本文为Adamin90原创文章,转载无需和我联系,但请注明来自http://www.lixiaopeng.top