【发布时间】:2022-03-03 13:02:08
【问题描述】:
我正在通过我的 docker compose 文件部署我的 docker 容器。
当我最初部署我的应用程序时,它会创建一个负载均衡器,但类型为“网络”。我无法使用这种类型重定向到 https。
我希望将我的负载均衡器创建为“应用程序”类型,然后设置从 http 到 https 的重定向。
我的容器仍将监听 80 端口。
奖励:我想在我的撰写文件中部署并附加我的 SSL 证书,以便在新部署时一切就绪。
如您所见,我尝试了一些方法,但无法正常工作。
谢谢
version: '3.8'
services:
web:
container_name: auction_web
image: <ECR Image>
# x-aws-pull_credentials: arn:aws:secretsmanager:xxxxxxxxxxxx
depends_on:
- redis
ports:
# - "80:80" - tried this
# - "443:443" - tried this
- target: 80
x-aws-protocol: http
- target: 443
x-aws-protocol: https
# - published: 80
# protocol: "http"
# x-aws-alb-default-actions:
# - type: redirect
# host: '<domain>'
# port: 443
# protocol: HTTPS
# status-code: HTTP_301
# - published: 443
# protocol: "https"
# x-aws-acm-certificate: <cert name>
deploy:
resources:
limits:
cpus: '1'
memory: 4096M
【问题讨论】:
-
确实如此。当我做一个 docker compose up 时不喜欢那些参数。
标签: docker docker-compose amazon-ecs aws-load-balancer