Open techiall opened 4 years ago
web不会报这种错误吗 service specifies a port on the host. If multiple containers for this service are created on a single host, the port will clash
web不会报这种错误吗
service specifies a port on the host. If multiple containers for this service are created on a single host, the port will clash
web 不设置映射端口到宿主主机, 是不会有问题的, 通过 nginx 反代 web
web不会报这种错误吗
service specifies a port on the host. If multiple containers for this service are created on a single host, the port will clash
web 不设置映射端口到宿主主机, 是不会有问题的, 通过 nginx 反代 web
懂了
web 不能 映射端口出来 ====> 另外mysql/redis/es也不能暴露端口 (安全问题) nginx 作为对外的统一网关
某天心血来潮,
docker-compose --help
想看下docker-compose
有哪些自己没发现好玩的命令。然后就发现了
docker-compose scale
,使用方式如下简单总结一下也就是制定容器运行的个数,比如有一个 web 服务,你可以指定运行个数,比如
5
个。下面以我 Github 某个项目的 docker-compose 举例
Nginx 指定映射端口 8080,反向代理 web。
docker-compose scale
扩容 web当然了也可以扩容 mysql / redis / elasticsearch(需要配置
启动多个个 web 服务
这里提示命令已经过时,那我们换一个命令
这样子的就创建了 web 服务,nginx 容器配置一个
proxy_pass
即可。请求会通过 nginx 转发到不同的 web。