我正在学习如何使用 Docker,并且正在使用 Centos+PHP+MySQL 设置一个带有前端和后端的简单应用程序。
我有我的机器:“示例”
在机器“示例”中,我配置了 2 个 docker 容器:
frontend:
build: ./frontend
volumes:
- ./frontend:/var/www/html
- ./infrastructure/logs/frontend/httpd:/var/logs/httpd
ports:
- "80"
links:
- api
api:
build: ./api
volumes:
- ./api:/var/www/html
- ./infrastructure/logs/api/httpd:/var/logs/httpd
ports:
- "80"
links:
- mysql:container_mysql
我面临的问题是当我访问 docker 容器时,我需要为 FRONTEND (32771) 或 BACKEND (32772) 指定端口号。
这是正常的还是有办法为应用程序的 API 和前端创建主机名?
这在部署到 AWS 时如何工作?
提前致谢。