I want to publish multiple ports for my app that is built from a Dockerfile using flyctl deploy. As far as I know, we don’t have access to the docker run command, if I did I believe I would want it to look like this: docker run -p 80:80 -p 443:443 -p 10001:2019 my-app-image
How can I accomplish this?
Below is my fly.toml:
app = "my-app"
[mounts]
destination = "/config"
source = "config"
# port 80 mapping
[[services]]
internal_port = 80
protocol = "tcp"
[[services.ports]]
port = "80"
# port 443 mapping
[[services]]
internal_port = 443
protocol = "tcp"
[[services.ports]]
port = "443"
# port 2019 mapping
[[services]]
internal_port = 2019
protocol = "tcp"
[[services.ports]]
port = "10001"
Assuming you want multiple ports open publicly, that fly.toml looks correct. Is it not working? You may need to give it a few minutes after a deploy when ports change.
If you just want ports available over the private network, you don’t have to do anything. Anything you listen on in the container works.
If I understand what you’re asking right, yes. The fly deploy command sends the config. We use the [[services]] to block configure our load balancer for your app. The load balancer sends traffic in the defined ports to all instances of your application.
The EXPOSE and -p args Docker uses don’t really mean anything in our environment. They control how Docker sets up IP tables rules to forward ports on a local system.