Answers: <p>Since you are using the tag "Docker-Machine" I'm assuming that you are using Docker Toolbox to manage Docker.  The problem is most likely an issue with Virtual Box configuration than your Docker configuration.</p>
  
  <p>When you try pinging your container on port 9001, use the ip <code>0.0.0.0</code> instead of <code>127.0.0.1</code> or <code>localhost</code>.  Another way to test would be to get the IP address of the docker-machine, <code>docker-machine ip</code>, and use this IP to ping your container (e.g. use <code>192.168.99.100:9001</code>.</p>
  
  <p>If you are trying to access the container from another computer you may have to look into a solution like port forwarding as described <a href="http://woshub.com/port-forwarding-in-windows/" rel="nofollow noreferrer">here</a>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-09-03T16:02:15.403Z
Answers: 2019-09-03T16:02:15.403Z
Answers: Wesley Rolnick
Body: <p>I have an Angular application deployed in the container . If I log in to the container I can curl to the port 4200.</p>
  
  <p>I have mapped to port 9001 to connect from my host .</p>
  
  <p>But I can't curl from my host machine. What could be the issue?  I think I should configure with docker bridge how to do that?? </p>
  
  <p>My Docker file: </p>
  
  <pre><code>FROM alpine:latest
  
  #installing required pakages
  RUN apk update
  RUN apk fix
  RUN apk add nodejs nodejs-npm apache2 curl yarn
  RUN npm install -g @angular/cli
  RUN npm install -g typescript
  RUN mkdir -p /var/opt/angular
  
  WORKDIR /opt
  
  COPY . .
  
  WORKDIR /opt/frontend
  
  RUN npm install
  RUN ng build
  COPY start.sh /opt/frontend/start.sh
  RUN chmod +x start.sh
  
  EXPOSE 4200
  CMD ["sh", "start.sh"]
  </code></pre>
  
  <p>Start-up script(start.sh):</p>
  
  <pre><code>#!/bin/bash
  
  ng serve --host 0.0.0.0
  </code></pre>
  
  <p>While running the docker file I have specified.  -p 9001:4200</p>
  
Comments: CC BY-SA 4.0
Comments: 2019-09-02T08:00:35.260Z
Comments: please add your Dockerfile.
Comments: profesor79
Comments: CC BY-SA 4.0
Comments: 2019-09-03T20:51:47.080Z
Comments: A suggestion for your dockerfile, merge RUN commands like `RUN command1 && command2` to reduce the layers created and the image size.
Comments: Daniel Cortés
Tags: <docker><networking><ports><docker-machine>
Title: Docker bridge network Configuration for containers
UserDisplayName: Madan
ThreadText: # Docker bridge network Configuration for containers
  
  (Asked by: username_0 on 2019-09-02)
  
  I have an Angular application deployed in the container . If I log in to the container I can curl to the port 4200.
  
  I have mapped to port 9001 to connect from my host .
  
  But I can't curl from my host machine. What could be the issue? I think I should configure with docker bridge how to do that??
  
  My Docker file:
  
  ```
  FROM alpine:latest
  
  #installing required pakages
  RUN apk update
  RUN apk fix
  RUN apk add nodejs nodejs-npm apache2 curl yarn
  RUN npm install -g @angular/cli
  RUN npm install -g typescript
  RUN mkdir -p /var/opt/angular
  
  WORKDIR /opt
  
  COPY . .
  
  WORKDIR /opt/frontend
  
  RUN npm install
  RUN ng build
  COPY start.sh /opt/frontend/start.sh
  RUN chmod +x start.sh
  
  EXPOSE 4200
  CMD ["sh", "start.sh"]
  
  ```
  
  Start-up script(start.sh):
  
  ```
  #!/bin/bash
  
  ng serve --host 0.0.0.0
  
  ```
  
  While running the docker file I have specified. -p 9001:4200
  
  **Tags:** docker, networking, ports, docker-machine
  
  > **Comments:**
  > **username_1**: please add your Dockerfile.  
  > **username_2**: A suggestion for your dockerfile, merge RUN commands like `RUN command1 && command2` to reduce the layers created and the image size.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2019-09-03. Score: 1
  
  Since you are using the tag "Docker-Machine" I'm assuming that you are using Docker Toolbox to manage Docker. The problem is most likely an issue with Virtual Box configuration than your Docker configuration.
  
  When you try pinging your container on port 9001, use the ip `0.0.0.0` instead of `127.0.0.1` or `localhost`. Another way to test would be to get the IP address of the docker-machine, `docker-machine ip`, and use this IP to ping your container (e.g. use `192.168.99.100:9001`.
  
  If you are trying to access the container from another computer you may have to look into a solution like port forwarding as described [here](http://woshub.com/port-forwarding-in-windows/).
  
  
  ---
  
  