1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 阿里云docker安装nginx和tomcat

阿里云docker安装nginx和tomcat

时间:2022-05-05 16:49:03

相关推荐

阿里云docker安装nginx和tomcat

第一步:

docker pull nginx

可以看到docker的联合文件系统,分层pull

接着敲命令:

docker images

查看docker镜像,可以看到nginx

第二步:

启动nginx

docker run -d -p 80:80 nginx 以后台方式启动docker,端口映射为外部80映射容器80端口

docker ps 查看docker启动的容器

curl localhost:80 访问80端口,返回html页面信息

打开外部网页访问:

安装tomcat:

docker pull tomcat

docker run -d -p 8888:8080 tomcat

curl localhost:8888

返回404,说明webapps底下没有项目

查看tomcat容器ID:

docker ps

以交互模式进入容器tomcat内:

docker exec -ite1057fd3cb2d /bin/bash

把 webapps.dist目录下项目拷贝至webapps:

cp -r webapps.dist/* webapps

退出tomcat容器:

exit

再次访问localhost:8888端口:

curl localhost:8888

此时显示html页面:

从web端访问tomcat页面,此时一直是等待刷新状态。

打开阿里云的防火墙配置

此时就可以访问了

收工

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。