惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
T
Tenable Blog
Webroot Blog
Webroot Blog
L
Lohrmann on Cybersecurity
S
Securelist
S
Schneier on Security
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
I
Intezer
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
TaoSecurity Blog
TaoSecurity Blog
S
Secure Thoughts
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Privacy International News Feed
H
Hacker News: Front Page
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
博客园 - Franky
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Azure Blog
Microsoft Azure Blog
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog
P
Proofpoint News Feed
S
Security Affairs
WordPress大学
WordPress大学
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
小众软件
小众软件
F
Full Disclosure
博客园 - 叶小钗
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
Security Latest
Security Latest
P
Proofpoint News Feed
月光博客
月光博客
T
Tailwind CSS Blog
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
T
Threat Research - Cisco Blogs
Help Net Security
Help Net Security
Project Zero
Project Zero

Docker 从入门到实践

修订记录 如何贡献 Docker — 从入门到实践 高级网络配置 容器访问控制 自定义网桥 编辑网络配置文件 配置 docker0 网桥 工具和示例 映射容器端口到宿主主机的实现 示例:创建一个点到点连接 快速配置指南 附录 Dockerfile 最佳实践 Docker 命令查询 客户端命令(docker) 服务端命令(dockerd) 如何调试 Docker 常见问题总结 热门镜像介绍 Node.js 资源链接 归档项目 基本概念 Docker 容器 Docker 镜像 Docker Buildx 使用 BuildKit 构建镜像 使用 Buildx 构建镜像 使用 buildx 构建多种系统架构支持的 Docker 镜像 CI/CD GitHub Actions Drone Demo Drone 部署 Drone Alpine Busybox CentOS/Fedora Debian/Ubuntu 容器与云计算 亚马逊云 腾讯云 Docker Compose 项目 Compose 命令说明 Compose 模板文件 使用 Django 安装与卸载 Compose 简介 使用 compose 搭建 LNMP 环境 使用 Rails 使用 使用 WordPress 操作 Docker 容器 进入容器 后台运行 导出和导入容器 删除容器 启动容器 终止容器 Fedora CoreOS 安装 Fedora CoreOS Fedora CoreOS 介绍 Docker 数据管理 挂载主机目录 数据卷 etcd 集群 使用 etcdctl 使用 etcdctl v2 什么是 etcd 在 IDE 中使用 Docker VS Code 中使用 Docker 使用 Dockerfile 定制镜像 使用 Docker 镜像 利用 commit 理解镜像构成 Dockerfile 指令详解 ADD 更高级的复制文件 ARG 构建参数 CMD 容器启动命令 COPY 复制文件 ENTRYPOINT 入口点 CentOS minio MongoDB MySQL Nginx PHP Redis Ubuntu WordPress Docker Registry 操作系统 本章小结 阿里云 简介 本章小结 etcd 安装 Docker — 从入门到实践
EXPOSE 声明端口
2022-05-13 · via Docker 从入门到实践

# EXPOSE 声明端口

格式为 EXPOSE <端口1> [<端口2>...]

EXPOSE 指令是声明容器运行时提供服务的端口,这只是一个声明,在容器运行时并不会因为这个声明应用就会开启这个端口的服务。在 Dockerfile 中写入这样的声明有两个好处,一个是帮助镜像使用者理解这个镜像服务的守护端口,以方便配置映射;另一个用处则是在运行时使用随机端口映射时,也就是 docker run -P 时,会自动随机映射 EXPOSE 的端口。

要将 EXPOSE 和在运行时使用 -p <宿主端口>:<容器端口> 区分开来。-p,是映射宿主端口和容器端口,换句话说,就是将容器的对应端口服务公开给外界访问,而 EXPOSE 仅仅是声明容器打算使用什么端口而已,并不会自动在宿主进行端口映射。