Boot2docker (MAC) NAT container port to host, external access

Source: Internet
Author: User
Tags docker ps

Boot2docker with the VBox, so use VBox's command to do NAT


#先要停掉所有的容器

Docker Ps-a-Q | Xargs Docker Stop

#停到boot2docker

Boot2docker stop

#如果容器的端口是 8080 (docker-p 18,080:8,080)

Vboxmanage modifyvm "BOOT2DOCKER-VM"--natpf1 "tcp-port$i,tcp,,18080,,18080";

#重启boot2docker virtual Machines

Boot2docker start

#重启你自己的容器

。。。

It is now possible to access the container service in the virtual machine via "local ip+18080" on other LAN machines.

PS: Open 10000 to 20000 ports

For i in {10000..20000}; Do
Vboxmanage modifyvm "BOOT2DOCKER-VM"--natpf1 "tcp-port$i,tcp,, $i,, $i";
Vboxmanage modifyvm "BOOT2DOCKER-VM"--natpf1 "udp-port$i,udp,, $i,, $i";
Done

Boot2docker (MAC) NAT container port to host, external access

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.