我目前正在开发一个使用 Docker 和 Apache Mesos/Marathon 的团队项目。要在 Mesos/Marathon 上部署 MySQL docker 容器,我们必须创建一个带有端口映射的 JSON 文件。我在互联网上到处搜索,只是找不到任何示例 JSON 文件来查找端口映射。以前有人做过吗?
1 回答
Here's some example Marathon JSON for using Docker's bridged networking mode:
{
"id": "bridged-webapp",
"cmd": "python3 -m http.server 8080",
"cpus": 0.5,
"mem": 64.0,
"instances": 2,
"container": {
"type": "DOCKER",
"docker": {
"image": "python:3",
"network": "BRIDGE",
"portMappings": [
{ "containerPort": 8080, "hostPort": 0, "servicePort": 9000, "protocol": "tcp" },
{ "containerPort": 161, "hostPort": 0, "protocol": "udp"}
]
}
}
}
See the "Bridged Networking Mode" section in https://mesosphere.github.io/marathon/docs/native-docker.html for more details.