How to access container from dev machine on Docker for windows

0 votes

I’m using a window 10 machine with docker for windows installed in it.

When I run containers using docker compose:

version: '2'
services:
    service_a:
        build: .
        container_name: docker

It creates a network default,

But the container has IP 172.18.0.4, and I can’t connect to 172.18.0.4 from host.

How can I access this container from host machine?

Nov 6, 2018 in Docker by Sophie may
• 10,620 points
1,545 views

1 answer to this question.

0 votes

What you can do is, allow access to internal docker networks from your dev machine, try this:

route /P add 172.0.0.0 MASK 255.0.0.0 10.0.75.2
answered Nov 6, 2018 by Sophie may
• 10,620 points
HI,  when I execute "route /P add 172.0.0.0 MASK 255.0.0.0 10.0.75.2  it says "The requested operation requires elevation."
Hi,

Yes, you can't connect to your container from the host machine. Because Docker containers work in an isolated environment. So you need to expose the container.

Related Questions In Docker

+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,220 points

edited Oct 16, 2018 by lina 34,135 views
+1 vote
7 answers

How to connect to a Docker container running mysql on Windows 10?

Avoid using bind_address in your my.cnf file. I don't ...READ MORE

answered Apr 25, 2019 in Docker by Haseeb
12,631 views
0 votes
1 answer

How to enable/ disable Hyper-V for Docker on Windows?

You can do this from command prompt ...READ MORE

answered Sep 10, 2018 in Docker by Tyrion anex
• 8,700 points
6,490 views
0 votes
1 answer

How to run an image with volume on docker for windows?

Try : declaring the volume of container mounting the ...READ MORE

answered Sep 20, 2018 in Docker by Tyrion anex
• 8,700 points
880 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,714 views
+1 vote
1 answer
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP