简体   繁体   中英

docker-machine - unable to connect to rest url

I am running an application in docker setup locally [Installed docker using homebrew in Mac].

I get Could not get any response from postman or Empty reply from server in curl calls.

I tried all the solutions mentioned in docker-machine: Can't access container's web server from host , but none worked for me. I am not sure why I am not able to access the URL.

I am attaching the docker ps and docker-machine env output.

在此处输入图片说明

I am also attaching my docker-compose.yml

version: '3.2'
services:
  details:
    image:  localhost:5000/my-details-1
    container_name: details
    #build: ./details
    expose:
      - 9080
  ratings:
    image: localhost:5000/my-ratings-1
    container_name: ratings
    #build: ./ratings
    expose:
      - 9080
  reviews:
    image: localhost:5000/my-reviews-1
    container_name: reviews
    #build: ./reviews/reviews-wlpcfg
    expose:
      - 9080
  restwrapjdbc:
    image: localhost:5000/my-restwrapjdbc
    container_name: restwrapjdbc
    #build: ./RestWrapJDBC
    expose:
      - 8085
  mirest:
    image: localhost:5000/my-mirest
    container_name: mirest
    #build: ./MIRest
    #network_mode: "host"
    expose:
      - 8085
    ports:
      - target: 8085
        published: 8085
        protocol: tcp
        mode: hosts

EDITED:

I forgot to include the url-pattern from web.xml . Including that string to the url worked.

You have wrong port maping. Seems like your image exposes port 8080. But you map 8085 to 8085.

Instead:

expose:
      - 8085
ports:
      - target: 8085
        published: 8085
        protocol: tcp
        mode: hosts

write

ports:
      - 8085:8080

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM