docker-machine: Can't access container's web server from host

后端 未结 6 1454
醉酒成梦
醉酒成梦 2020-12-23 09:39

I just installed Docker with Docker-Toolbox on my Mac using homebrew: install docker with homebrew

After creating and configuring a Container with Rails, Postgres an

6条回答
  •  清歌不尽
    2020-12-23 10:17

    You can find a right address to call your page this way First, find the CONTAINER ID by:

    $ docker ps
    

    You will get the information like this:

    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                          NAMES
    56dd4d582b08        abc01               "python app.py"     10 minutes ago      Up 11 minutes       80/tcp, 0.0.0.0:80->4000/tcp   flamboyant_bell
    

    Now you know the port: 4000 (scroll right this row). So that the address should be like this:

    http://192.168.99.100:4000/
    

    However, you can double check:

    $ docker port 56dd4d582b08
    

    You will get in this case the following info:

    4000/tcp -> 0.0.0.0:80
    

    Now you can try to look you project at

    http://192.168.99.100:4000/
    

提交回复
热议问题