Docker学习记录:安装nginx

1.基本操作

先查看一下,目前开放了哪些

复制代码
kt@kt-SYS-4028GR-TR2:~$ sudo nmap -sT localhost
Starting Nmap 7.80 ( https://nmap.org ) at 2025-01-06 11:02 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00017s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE
631/tcp  open  ipp
3389/tcp open  ms-wbt-server

Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds
kt@kt-SYS-4028GR-TR2:~$ sudo nmap -sS -p- localhost
[sudo] password for kt: 
Starting Nmap 7.80 ( https://nmap.org ) at 2025-01-06 11:22 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000060s latency).
Not shown: 65528 closed ports
PORT      STATE SERVICE
631/tcp   open  ipp
3389/tcp  open  ms-wbt-server
7890/tcp  open  unknown
11434/tcp open  unknown
35600/tcp open  unknown
41389/tcp open  unknown
53000/tcp open  unknown

kt@kt-SYS-4028GR-TR2:~$ sudo docker search nginx
NAME                                     DESCRIPTION                                     STARS     OFFICIAL
nginx                                    Official build of Nginx.                        20493     [OK]
nginx/nginx-ingress                      NGINX and  NGINX Plus Ingress Controllers fo...   100       
nginx/nginx-prometheus-exporter          NGINX Prometheus Exporter for NGINX and NGIN...   46        
nginx/unit                               This repository is retired, use the Docker o...   64        


kt@kt-SYS-4028GR-TR2:~$ sudo docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
fd674058ff8f: Pull complete 
566e42bcee1c: Pull complete 
2b99b9c5d9e5: Pull complete 
bd98674871f5: Pull complete 
1e109dd2a0d7: Pull complete 
da8cc133ff82: Pull complete 
c44f27309ea1: Pull complete 
Digest: sha256:42e917aaa1b5bb40dd0f6f7f4f857490ac7747d7ef73b391c774a41a8b994f15
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
kt@kt-SYS-4028GR-TR2:~$ sudo docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
mongo        latest    f08e39122805   4 weeks ago   855MB
nginx        latest    f876bfc1cc63   5 weeks ago   192MB
centos       latest    5d0da3dc9764   3 years ago   231MB

2.运行,后台,自定义名字

复制代码
kt@kt-SYS-4028GR-TR2:~$ sudo docker run -d --name mynginx1 -p 3344:80 nginx
715d389f0eebeb858389865f4f130b417afaadb5033967fca7bcf259adfb4119

3.内部访问:外部访问:

复制代码
kt@kt-SYS-4028GR-TR2:~$ sudo curl localhost:3344
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

4.其他

复制代码
kt@kt-SYS-4028GR-TR2:~$ sudo docker ps -a
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                      PORTS     NAMES
715d389f0eeb   nginx     "/docker-entrypoint...."   10 minutes ago   Exited (0) 4 seconds ago              mynginx1
8f8c91c95206   nginx     "/docker-entrypoint...."   12 minutes ago   Exited (0) 11 minutes ago             mynginx
kt@kt-SYS-4028GR-TR2:~$ sudo docker rm -f 8f8c
8f8c
kt@kt-SYS-4028GR-TR2:~$ sudo docker ps -a
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                      PORTS     NAMES
715d389f0eeb   nginx     "/docker-entrypoint...."   10 minutes ago   Exited (0) 29 seconds ago             mynginx1
kt@kt-SYS-4028GR-TR2:~$ 

以上,只是记录。无他

相关推荐
✎ ﹏梦醒͜ღ҉繁华落℘26 分钟前
FreeRTOS学习笔记(应用)-- 各种 信号量的应用场景
笔记·学习
芥子沫30 分钟前
《玩转Docker》[应用篇13]:Docker安装部署Emby及使用技巧:家庭媒体服务器
docker·视频·emby
星星火柴93631 分钟前
笔记 | C++面向对象高级开发
开发语言·c++·笔记·学习
BeingACoder40 分钟前
【SAA】SpringAI Alibaba学习笔记(一):SSE与WS的区别以及如何注入多个AI模型
java·笔记·学习·saa·springai
安全不再安全2 小时前
免杀技巧 - 早鸟注入详细学习笔记
linux·windows·笔记·学习·测试工具·web安全·网络安全
BreezeJuvenile2 小时前
外设模块学习(8)——HC-SR04超声波模块(STM32)
stm32·单片机·嵌入式硬件·学习·超声波测距模块·hc-sr04
爱宇阳2 小时前
从容器化到自动化:Spring Boot 项目 Docker 部署与 GitLab CI/CD 集成 Harbor 全流程
spring boot·docker·自动化
LBuffer2 小时前
破解入门学习笔记题三十八
笔记·学习
微露清风3 小时前
系统性学习C++-第十讲-stack 和 quene
java·c++·学习
PyAIGCMaster3 小时前
钉钉的设计理念方面,我可以学习
人工智能·深度学习·学习·钉钉