I have Amazon ECS cluster with EC2 Launch type.
I try to run docker (Linux) container with 25 and 587 port mapping.
Dockerfile is very simple:
FROM microsoft/dotnet:2.0-runtime AS base
WORKDIR /app
FROM microsoft/dotnet:2.0-sdk AS build
WORKDIR /src
COPY *.sln ./
COPY MailTool.Smtp/MailTool.Smtp.csproj MailTool.Smtp/
RUN dotnet restore
COPY . .
WORKDIR /src/MailTool.Smtp
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
EXPOSE 25
EXPOSE 587
ENTRYPOINT ["dotnet", "MailTool.Smtp.dll"]
I have used default setting for my Task Definition.
Task Definition Network Mode is Bridge.
I have mapped ports as depicted on a screenshot:
When I have started new task I have the error:
Status reason CannotStartContainerError: API error (500): driver failed programming external connectivity on endpoint ecs-1-8-1-febb999cf990b2f53700 (646613a2e4c7ae1f0c8e82a2100d468eba09c7dbd64caddde3d14901d14a775c): Error starting userland proxy: listen tcp 0.0.0.0:25
I have the error only on Linux type container. If I use Windows type container then all works fine.
If I change mappings 125 (host port) -> 25 (container port) then task works fine also.
As I understand port 25 for Linux is unavailable...
How can I use port 25 on Amazon ECS EC2 instance for Linux docker containers?