Browse Source
Bind port in docker with udp flag when protocol is udp (#915 )
* Bind port in docker with udp flag when port protocol is udp
* Update src/Microsoft.Tye.Hosting/DockerRunner.cs
Co-authored-by: Justin Kotalik <jukotali@microsoft.com>
* Added error when using udp binding for project service
Co-authored-by: Justin Kotalik <jukotali@microsoft.com>
philliphoff-multiplatform
Tim Potze
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
11 additions and
1 deletions
src/Microsoft.Tye.Hosting/DockerRunner.cs
src/Microsoft.Tye.Hosting/ProxyService.cs
@ -79,6 +79,11 @@ namespace Microsoft.Tye.Hosting
continue ;
}
if ( string . Equals ( binding . Protocol , "udp" , StringComparison . InvariantCultureIgnoreCase ) )
{
throw new CommandException ( "Proxy does not support the udp protocol yet." ) ;
}
var b = new ServiceBinding ( )
{
ConnectionString = binding . ConnectionString ,
@ -232,7 +237,7 @@ namespace Microsoft.Tye.Hosting
// These are the ports that the application should use for binding
// 1. Tell the docker container what port to bind to
portString = docker . Private ? "" : string . Join ( " " , ports . Select ( p = > $"-p {p.Port}:{p.ContainerPort ?? p.Port}" ) ) ;
portString = docker . Private ? "" : string . Join ( " " , ports . Select ( p = > $"-p {p.Port}:{p.ContainerPort ?? p.Port}{(string.Equals(p.Protocol, " udp ", StringComparison.OrdinalIgnoreCase) ? " / udp " : string.Empty)} " ) ) ;
if ( docker . IsAspNet )
{
@ -63,6 +63,11 @@ namespace Microsoft.Tye.Hosting
continue ;
}
if ( string . Equals ( binding . Protocol , "udp" , StringComparison . InvariantCultureIgnoreCase ) )
{
throw new CommandException ( "Proxy does not support the udp protocol yet." ) ;
}
var ports = binding . ReplicaPorts ;
// We need to bind to all interfaces on linux since the container -> host communication won't work