Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

542
Visualizações
Docker ip for windows

I'm testing out Docker with a basic .NET core project. I Build and image from this docker file:

FROM microsoft/dotnet:latest

COPY . /app

WORKDIR /app/API

RUN ["dotnet", "restore"]

RUN ["dotnet", "build"]

EXPOSE 5000/tcp

CMD ["dotnet", "run", "--server.urls", "http://*:5000"]

I run it and it goes flawlessly. Now the only problem is, on what IP is it running ?

I'm running Docker on Windows!

Regards

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

You're already exposing the port internally, so the only other thing I can suggest is to check you are opening the port when launching your image too:

docker run -it -p 5000:5000 <imagename>

This will open port 5000 inside the instance to port 5000 on your local machine, and should then be accessible on 127.0.0.1:5000 or localhost:5000.

You should also ensure that you are accepting any host name within Main() in Program.cs with .UseUrls("http://*:5000/") on your WebHostBuilder.

over 4 years ago · Santiago Trujillo Relatório

0

I had some issues with running linux containers built for dotnet asp.net core 2 on docker for windows.

The command I was using to run my container was:

docker run -it --rm -p 3394:3394 --name <name> <container>

I could shell to the container and verify the app was listening and returning results.

However, trying to access the app from my machine on port 3394 wouldn't work for 127.0.0.1, localhost, or my machine's NAT ip on the network.

However, running this command gives the IP address allocated by the docker host:

docker inspect -f "{{ .NetworkSettings.IPAddress }}" <name>

In my case the IP was 172.17.0.2. However, accessing 172.17.0.2:3394 still didn't work.

The last piece needed was to run the following in an elevated dos prompt:

route /P add 172.0.0.0 MASK 255.0.0.0 10.0.75.2

This added a route so my machine didn't seek the address via my WAN, which was diagnosed via tracert.

Credit goes to https://github.com/docker/for-win/issues/221

over 4 years ago · Santiago Trujillo Relatório

0

I was able to connect to exposed the container port via the docker machine IP address:

docker-machine ip

In my case this was 192.168.99.100

So for my mysql container (docker run -d -p 3306:33060 -e MYSQL_ROOT_PASSWORD=password mysql:5.7) So I was able to connect via 192.168.99.100:33060

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda