title: Is it possible to set a port under "host mode" in docker?
body: <p>Is it possible to config the port number in docker under "host mode"? </p>
  
  <p>I wanna bind the application to 5050 port instead of 80 port .</p>
  
  <p>However, when I run below script, it will default bind in 80 port:</p>
  
  <pre><code>sudo docker run --name=myname --network host -d webapi:1.0.0 --restart=always 
  </code></pre>
  
  <p>So I tried to run with "-p 5050", for example</p>
  
  <pre><code>sudo docker run --name=myname --network host -d webapi:1.0.0 --restart=always -p 5050
  sudo docker run --name=myname --network host -d webapi:1.0.0 --restart=always -p 5050:5050
  </code></pre>
  
  <p>Unfortunately, my Linux terminal returned with :</p>
  
  <pre><code>WARNING: Published ports are discarded when using host network mode
  </code></pre>
  
  <p>The docker image looks like something like this:</p>
  
  <p><a href="https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-2.2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-2.2</a></p>
  
  <p>And my Dockerfile looks like this:</p>
  
  <pre><code>FROM microsoft/dotnet:2.1-aspnetcore-runtime
  WORKDIR /publish
  COPY .  .
  EXPOSE 5050
  ENTRYPOINT ["dotnet", "WebApi.dll"]
  </code></pre>