Docker入门之路(一):部署Nginx
引言
如果对Docker不太熟悉的小伙伴们可以先去看一下Docker入门,再来看这篇文章哟!
https://blog.csdn.net/m0_53559551/article/details/121358336
那么如果是从我上一篇Docker入门文章过来的或者是对Docker有个基本了解的小伙伴们现在跟我一起来了解一下在Docker中部署Nginx的步骤吧。
步骤一:搜索Nginx镜像
PS C:\Users\ASUS> docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 15839 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 2096 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 819 [OK]
jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho… 279
linuxserver/nginx An Nginx container, brought to you by LinuxS… 160
tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp… 145 [OK]
jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 143 [OK]
alfg/nginx-rtmp NGINX, nginx-rtmp-module and FFmpeg from sou… 110 [OK]
jasonrivers/nginx-rtmp Docker images to host RTMP streams using NGI… 95 [OK]
nginxdemos/hello NGINX webserver that serves a simple page co… 78 [OK]
privatebin/nginx-fpm-alpine PrivateBin running on an Nginx, php-fpm & Al… 60 [OK]
nginx/nginx-ingress NGINX and NGINX Plus Ingress Controllers fo… 57
nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 54
staticfloat/nginx-certbot Opinionated setup for automatic TLS certs lo… 25 [OK]
nginxproxy/nginx-proxy Automated Nginx reverse proxy for docker con… 25
nginx/nginx-prometheus-exporter NGINX Prometheus Exporter for NGINX and NGIN… 22
schmunk42/nginx-redirect A very simple container to redirect HTTP tra… 19 [OK]
centos/nginx-112-centos7 Platform for running nginx 1.12 or building … 16
centos/nginx-18-centos7 Platform for running nginx 1.8 or building n… 13
raulr/nginx-wordpress Nginx front-end for the official wordpress:f… 13 [OK]
mailu/nginx Mailu nginx frontend 9 [OK]
sophos/nginx-vts-exporter Simple server that scrapes Nginx vts stats a… 7 [OK]
ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 3 [OK]
wodby/nginx Generic nginx 1 [OK]
arnau/nginx-gate Docker image with Nginx with Lua enabled on … 1 [OK]
步骤二:下载镜像
PS C:\Users\ASUS> docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
eff15d958d66: Pull complete
1e5351450a59: Pull complete
2df63e6ce2be: Pull complete
9171c7ae368c: Pull complete
020f975acd28: Pull complete
266f639b35ad: Pull complete
Digest: sha256:097c3a0913d7e3a5b01b6c685a60c03632fc7a2b50bc8e35bcaa3691d788226e
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
步骤三:运行镜像
PS C:\Users\ASUS> docker run -d --name nginx01 -p 3344:80 nginx
8b5827a8d365c7eeb41d48ec418a319b57bd2177a8e4b835c734b8032a568a50
步骤四:修改配置
PS C:\Users\ASUS> docker exec -it nginx01 /bin/bash
root@8b5827a8d365:/# ls
bin dev docker-entrypoint.sh home lib64 mnt proc run srv tmp var
boot docker-entrypoint.d etc lib media opt root sbin sys usr
root@8b5827a8d365:/# cd etc
root@8b5827a8d365:/etc# ls
adduser.conf debian_version group- issue.net mke2fs.conf passwd rc6.d ssl
alternatives default gshadow kernel motd passwd- rcS.d subgid
apt deluser.conf gshadow- ld.so.cache mtab profile resolv.conf subuid
bash.bashrc dpkg gss ld.so.conf netconfig profile.d rmt systemd
bindresvport.blacklist e2scrub.conf host.conf ld.so.conf.d nginx rc0.d security terminfo
ca-certificates environment hostname libaudit.conf nsswitch.conf rc1.d selinux timezone
ca-certificates.conf fonts hosts localtime opt rc2.d shadow ucf.conf
cron.d fstab init.d login.defs os-release rc3.d shadow- update-motd.d
cron.daily gai.conf inputrc logrotate.d pam.conf rc4.d shells xattr.conf
debconf.conf group issue machine-id pam.d rc5.d skel
root@8b5827a8d365:/etc# cat nginx.conf
cat: nginx.conf: No such file or directory
root@8b5827a8d365:/etc# cd nginx
root@8b5827a8d365:/etc/nginx# cat nginx.confuser nginx;
worker_processes auto;error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;events {worker_connections 1024;
}http {include /etc/nginx/mime.types;default_type application/octet-stream;log_format main '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log /var/log/nginx/access.log main;sendfile on;#tcp_nopush on;keepalive_timeout 65;#gzip on;include /etc/nginx/conf.d/*.conf;
}
步骤五:运行测试
访问地址:localhost:3344
Docker入门之路(一):部署Nginx相关推荐
- 写给Java开发看的 Docker 干货(零基础部署Nginx MySQL SpringBoot)
前言 Docker是当下使用最多的一种容器技术,想精通Docker并不容易,在公司生产中会有专门的运维人员负责.但是身为开发人员,适当的学习Docker是必要的.Docker的好处这里就不介绍了,网上 ...
- Ubuntu 17.04 x64 安装 Docker CE 初窥 Dockerfile 部署 Nginx
Docker 是个划时代的开源项目,它彻底释放了计算虚拟化的威力,极大提高了应用的运行效率,降低了云计算资源供应的成本!使用 Docker,可以让应用的部署.测试和分发都变得前所未有的高效和轻松! 无 ...
- Docker使用docker-compose配合Makefile部署Nginx 挂载文件目录 实现视频图片html等静态资源的代理
-> Docker及docker compose的安装点这里 1.编写nginx.conf文件 events {# 最大连接数worker_connections 1024; }http {se ...
- Docker | 入门
Docker | 入门 此文用于总结主要在ios系统下学习Docker的记录. 2021/12/11, to be continued with Dockerfile指令详解 ENTRYPOINT 入 ...
- docker入门与部署微服务--学习笔记
最近公司进一步去windows,走向 linux+云化. 原来的一大坨windows虚拟机服务器都要转向linux, 既然走向linux的话,那么docker肯定是要涉足的. 故学习了docker入门 ...
- Docker学习之路04:创建定制Nginx镜像
Docker学习之路04:创建定制Nginx镜像 Docker学习路线传送门: Docker学习之路01:Docker的安装 Docker学习之路02:阿里云镜像加速器 Docker学习之路03:Do ...
- Docker入门 服务部署的艺术
Docker入门 服务部署的艺术 本课程可能涉及的内容 :Docker核心命令, Docker软件部署,Dockerfile镜像制作, Docker实战, Docker集群搭建 Docker需求:高可 ...
- docker初体验:docker部署nginx负载均衡集群
Docker 是一个用于开发,交付和运行应用程序的开放平台.Docker 使您能够将应用程序与基础架构分开,从而可以快速交付软件.今天来为大家演示一下docker部署nginx负载均衡集群 环境 ce ...
- docker初体验:docker部署nginx服务
Docker 是一个用于开发,交付和运行应用程序的开放平台.Docker 使您能够将应用程序与基础架构分开,从而可以快速交付软件.今天来为大家演示一下docker部署nginx 环境 centos7 ...
最新文章
- ArrayList集合为什么不能使用foreach增删改
- MyEclipse扩展功能设置(Eclipse代码提示功能)
- ​5G行业应用成熟度洞察,哪些场景将率先起飞?|新基建技术洞察之
- php中qq授权登录,ThinkPHP利用QQ互联实现网站第三方登录(QQ登录)
- [WebKit] JavaScriptCore解析
- mysql分窗函数_频谱分析中如何选择合适的窗函数
- ASP.NET 动态加载WebService功能
- VxWorks程序一下载就停住了
- 昔日光伏巨头赛维LDK迎“接盘侠” 平煤系深度整合产业链
- java自定义注解解析
- matlab mac 更改语言,MAC让Matlab编辑器显示中文的方法
- c语言串口通信实验报告,单片机实验报告-串口实验
- java生成数据库三线表
- echarts 饼状图展示位置 legend
- Windows下LimeSDR Mini使用说明
- docker部署分布式应用_Docker服务,堆栈和分布式应用程序捆绑
- Android Studio 中Locat使用包名过滤无法显示的问题
- 图神经网络-图游走类模型-作业
- latex 背景颜色设置
- SaaS云服务应用的访问安全性分析