docker nacos 添加端口映射
时间: 2023-10-15 07:02:34 浏览: 165
要在Docker中为Nacos添加端口映射,可以使用以下命令:
```
docker run --env MODE=standalone --name nacos --restart=always -d -p [主机端口]:[容器端口] nacos/nacos-server
```
其中,[主机端口]是你期望映射到主机的端口号,[容器端口]是Nacos容器内部的端口号。通过将这两个端口号替换成具体的数值,就可以实现端口映射。例如,如果你想将主机的8888端口映射到Nacos容器的8848端口,可以运行以下命令:
```
docker run --env MODE=standalone --name nacos --restart=always -d -p 8888:8848 nacos/nacos-server
```
这将在Docker中创建一个名为nacos的容器,并将主机的8888端口映射到容器的8848端口。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [docker安装nacos](https://blog.csdn.net/JiMoXiaoHunRen/article/details/130839282)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [docker中使用mysql数据库实现局域网访问](https://download.csdn.net/download/weixin_38680340/14049023)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文