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

推荐订阅源

V
Vulnerabilities – Threatpost
P
Proofpoint News Feed
The Hacker News
The Hacker News
Know Your Adversary
Know Your Adversary
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
AWS News Blog
AWS News Blog
S
Securelist
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
IT之家
IT之家
腾讯CDC
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
C
Check Point Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Engineering at Meta
Engineering at Meta
Latest news
Latest news
A
About on SuperTechFans
The Register - Security
The Register - Security
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
C
Cisco Blogs
T
Tailwind CSS Blog
Simon Willison's Weblog
Simon Willison's Weblog
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
T
Tor Project blog
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
B
Blog RSS Feed
Scott Helme
Scott Helme
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
NISL@THU
NISL@THU
P
Privacy International News Feed
Security Latest
Security Latest
Recorded Future
Recorded Future
L
LangChain Blog
Cyberwarzone
Cyberwarzone
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
O
OpenAI News
T
Threat Research - Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale

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 仅仅是声明容器打算使用什么端口而已,并不会自动在宿主进行端口映射。