多彩编程 多彩编程MZPH · CODE BLOG
ARTICLE DETAIL

文章详情

深耕前端与后端开发技术的一线实战笔记与踩坑复盘。

跟着狂神学docker笔记-----作业练习部署nginx

跟着狂神学docker笔记-----作业练习部署nginx 学习目标作业练习作业一部署nginx学习内容1docker search nginx #搜索镜像我在vm用centos虚拟机搜索的结果为什么会这样但是好像不影响pull下载镜像[rootlocalhost ~]# docker search nginxError response from daemon: Get “https://index.docker.io/v1/search?qnginxn25”: dial tcp 157.240.17.35:443: connect: connection refused2docker pull nginx #下载镜像[rootlocalhost ~]# docker pull nginxUsing default tag: latestlatest: Pulling from library/nginx26c307b5e35a: Pull complete3c55dc422a81: Pull completed84ae7b21412: Pull completec0df8d325117: Pull completeb8b80b9bc028: Pull completef5de6e85ac74: Pull complete5a4222b844e8: Pull completeDigest: sha256:21f8c0e3416b84eeec895c80077da69e2d25938cb0fc4bcc6a2ea33699b75703Status: Downloaded newer image for nginx:latestdocker.io/library/nginx:latest3查看镜像 docker images[rootlocalhost ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEnginx latest 5253dc86cc93 9 hours ago 161MBtomcat 9.0 b326c1d164e9 31 hours ago 422MBhello-world latest e2ac70e7319a 4 months ago 10.1kBcentos latest 5d0da3dc9764 4 years ago 231MB4启动镜像[rootlocalhost ~]# docker run -d --name nginx01 -p 3344:80 nginx0d807fe678386817c18308598c240ff2a7b4e88d9bd0bc5c090e47973bd3155a端口3344 80啥的我也不懂大学没好好学习5本机自测[rootlocalhost ~]# curl localhost:3344Welcome to nginx!Welcome to nginx!If you see this page, nginx is successfully installed and working.Further configuration is required for the web server, reverse proxy,API gateway, load balancer, content cache, or other features.For online documentation and support please refer tonginx.org.To engage with the community please visitcommunity.nginx.org.For enterprise grade support, professional services, additionalsecurity features and capabilities please refer tof5.com/nginx.Thank you for using nginx.*6端口暴露映射概念听得很模糊应该是水平没到按我的理解就是docker里面的nginx01和centos之间需要连通就得各自端口而命令-p 334480就把这两个端口打通同理centos和外网应该也是这样。Ps个人理解如有错误请告诉我我真的很需要浏览器界面7进入容器docker exec -it nginx01 /bin/bash8退出容器并停止nginxexitdocker stop container id思考问题每次改动nginx配置文件都得进入容器内部十分麻烦是否能在容器外部提供一个映射路径达到在容器修改文件名容器内部就能自动修改此处看弹幕是引出后面的学习内容——数据卷…慢慢学吧学习时间2026 8.5 pm学习产出
返回列表