Ports
Ports
Ports within your container can be mapped to the host using the Docker option --publish:
# icm run -container fred -image hello-world -options "--publish 80:8080"
# icm run -container fred -image hello-world -options "--publish-all"
You must open the corresponding port on the host if you wish to access the port from outside. This can be achieved in a number of ways, including:
-
By editing the Terraform template file infrastructure.tf directly.
-
By issuing commands to the host using the icm ssh command.
-
By modifying the security settings in the console of the cloud provider.
You also have to ensure that you are not colliding with a port mapped to another container or service on the same host. Finally, keep in mind that --publish has no effect on containers when the overlay network is of type host.
The following example modifies the Terraform template for AWS to allow incoming TCP communication over port 563 (NNTP over TLS):
-
File: /ICM/etc/Terraform/AWS/VPC/infrastructure.tf
-
Resource: aws_security_group
-
Rule:
ingress { from_port = 563 to_port = 563 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] }