Port Publishing
Port publishing exposes a port from inside a workspace container on the host’s own IP address, the same idea as a Docker -p host:container mapping. Use it to reach a service running in a workspace directly through the host: a database, an SSH daemon, a game server, or any other TCP or UDP service.
For HTTP services that you want to reach by host name, a Workspace URL is usually the better fit. Reach for port publishing when you need a raw TCP or UDP port, or a non-HTTP protocol.
Publishing a port
Section titled “Publishing a port”Ports are configured in the Port configuration section of the workspace form, when you create a workspace or attach one to a host. Each row is one published port and has four parts:
- Protocol: TCP or UDP.
- Host IP (optional): the host address to bind on. Leave it blank to publish on all of the host’s addresses, or set it to bind the port to a single address.
- Host port: the port opened on the host.
- Workspace port: the port the service listens on inside the container.
A request to the host port is forwarded to the workspace port inside the container.
The host port must be free
Section titled “The host port must be free”The host port has to be available on the host. If it is already in use, or the host will not let the workspace claim it, the deployment fails: the workspace goes to an error state and the reason appears in its Messages section. Change the mapping to a free host port, then redeploy the workspace.