2

Running the following command results in 404 error in browser for 127.0.0.1:80 or 127.0.0.1:8080:

docker pull schickling/swagger-ui
docker run -d -p 127.0.0.1:80:80 -e API_URL=http://localhost:4000/swagger schickling/swagger-ui

docker pull swaggerapi/swagger-editor
docker run -p 127.0.0.1:8080:8080 swaggerapi/swagger-editor

The Docker VM for Mac is running and I am exploring this error. Other docker containers have the same problem and the issue seems not related only to Swagger UI.

It works when using the GUI tool Kitematic, but only on the following URL (URL seems to not be mapped to 127.0.0.1):

http://192.168.99.100:32771/
http://192.168.99.100:32770/#/

Docker processes:

$ docker ps
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS              PORTS                     NAMES
60f4058c07ef        swaggerapi/swagger-editor:latest   "http-server --cors -"   2 hours ago         Up 5 seconds        0.0.0.0:32770->8080/tcp   swagger-editor
28179c1eb01c        schickling/swagger-ui:latest       "sh run.sh"              3 hours ago         Up 3 seconds        0.0.0.0:32771->80/tcp     swagger-ui

Is it normal that it maps the ports to 192.168.99.100? Shouldn't it be in form of 127.0.0.1? I am running Docker for Mac...

Peter G.
  • 7,816
  • 20
  • 80
  • 154
  • Is there already something running on port 80 on your machine? Do you have more error logs? – n2o Aug 30 '16 at 09:01
  • The port is empty, I can attach the script I used to run Docker VM – Peter G. Aug 30 '16 at 11:49
  • 1
    I think the loopback address may be causing problems with the VM networking, try dropping the loopback and use `-p 80:80` and `-p 8080:8080`. Based on the documentation (https://docs.docker.com/docker-for-mac/networking/#/port-mapping) this feature should work. – Kevin Burdett Aug 30 '16 at 13:11
  • No it doesn't run, nothing gets printed for `swagger-ui` on port `80`. Although, for `swagger-editor` on port `8080` this happens `Starting up http-server, serving /editor Available on: http://127.0.0.1:8080 http://172.17.0.2:8080 Hit CTRL-C to stop the server` gets printed in the console together with a 404 error. Only the favicon gets displayed in the browser for `http://127.0.0.1:8080`, but not for `http://127.0.0.1:8080/editor`. – Peter G. Aug 30 '16 at 14:31

0 Answers0