amazon-web-services - 端口映射不适用于 mac 上的 docker
问题描述
我正在尝试为 spring boot 应用程序运行 docker 容器,但是我无法访问该应用程序。
我在 mac 上使用以下版本的 docker
Mac OS Mojave 版本
10.14.3 (18D109)
mac上的Docker版本:
anhs-MBP:spring-boot-with-fargate anhtrang$ docker --version
Docker version 18.09.2, build 6247962
我检查了容器日志和spring boot应用程序正常启动
容器日志:
019-08-12 01:08:42.885 INFO 6 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2019-08-12 01:08:43.026 INFO 6 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2019-08-12 01:08:43.045 INFO 6 --- [ main] c.e.s.SpringBootWithFargateApplication : Started SpringBootWithFargateApplication in 8.06 seconds (JVM running for 9.107)
启动 docker 容器的命令:
anhs-MBP:spring-boot-with-fargate anhtrang$ docker run -d -p 8080:8080 anhtrang/spring-boot-with-farget:0.0.1-SNAPSHOT
我还尝试在容器之外启动 Spring Boot 应用程序,它运行良好。我只是不明白为什么它不能暴露端口
我的 GitHub 存储库:
https://github.com/anhtv08/spring-boot-with-fargate
感谢任何快速帮助
解决方案
推荐阅读
- python-3.x - 可以通过单击按钮来创建列表框
- regex - 正则表达式匹配长度有限的字符串,如果存在数字数字,则不能超过 5 位
- c# - 链式方法中的 GraphQL 变异输入查询
- javascript - 在嵌入模板的 js 脚本中读取 Flask 发送的数据时获取 ReferenceError
- javascript - 映射一个数组并在里面调用异步函数
- django - 查找查询集的反向 ForeignKey 实例?
- database - 在 Thorntail 中定义数据源验证
- icecast - 如何按需从可执行文件中读取icecast流
- javascript - 如何将工具提示添加到 react + d3 分组和堆叠条形图?
- python - 如何在 Matplotlib 中设置热图的宽度?