Mac access docker-machine ip error

after mac has installed docker, follow the official documentation to operate docker-machine to create a local vm

$ docker-machine create --driver virtualbox default

then check

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
default   -        virtualbox   Running   tcp://192.168.99.102:2376           v18.05.0-ce   

add to the environment

$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.102:2376"
export DOCKER_CERT_PATH="/Users/xushuainan/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
-sharp Run this command to configure your shell: 
-sharp eval $(docker-machine env default)

Connect to the environment

eval "$(docker-machine env default)"

View ip

 $ docker-machine ip default
192.168.99.102

create a nginx

docker run -d -p 8000:80 nginx

View nginx

$curl $(docker-machine ip default):8000
curl: (7) Failed to connect to 192.168.99.102 port 8000: Connection refused

Why is this?
also before, it is the same to create a mysql in docker. If you connect to the inside of the container, the mysql can be used, but it cannot be accessed from the outside through the ip in the vm.
ask the Great God for guidance.

Mar.17,2021

naturally, the ip of docker-machine virtual machines is the ip, through which they communicate with each other. Believe it or not, you can access one of the virtual machines and see if you can ping the nginx service of the other machine.
then you need to make these virtual machines into a cluster. I do the Swarm cluster here, and then you can run service, and then you can host the port corresponding to the internal port of the container and so on.

  • There is no response when docker is opened under Mac.

    official website downloads the latest docker for Mac community version. After installation, click the icon and do not respond. I do not know how to solve p.s. 1 MacOS upgrade from 10.12 to 10.13. After opening docker, I found that there was no respo...

    Mar.08,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37799-2c09e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37799-2c09e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?