Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
docker network / assign ip config – 扎老铁
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
class="post-53371 post type-post status-publish format-standard hentry">

docker network / assign ip config

Assign static IP to Docker container

Easy with Docker version 1.10.1, build 9e83765.

First you need to create you own docker network (mynet123)

docker network create –subnet=172.18.0.0/16 mynet123
than simply run the image (I’ll take ubuntu as example)

docker run –net mynet123 –ip 172.18.0.22 -it ubuntu bash
then in ubuntu shell

ip addr
Additionally you could use

–hostname to specify a hostname
–add-host to add more entries to /etc/hosts
Docs (and why you need to create a network) at https://docs.docker.com/engine/reference/commandline/network_create/

You can set the IP while running it.

docker run –cap-add=NET_ADMIN -dit imagename /bin/sh -c “/sbin/ip addr add 172.17.0.12 dev eth0; bash”
See my example at https://github.com/RvdGijp/mariadb-10.1-galera

https://stackoverflow.com/questions/27937185/assign-static-ip-to-docker-container

Networking features in Docker for Mac

Currently the only way to access containers is by exposing a port.
See https://beta.docker.com/docs/mac/getting-started/#step-3-explore-the-application-and-run-examples814. There is no docker0 on the Mac.

https://docs.docker.com/docker-for-mac/networking/

发表评论

电子邮件地址不会被公开。