用vagrant起的docker-host部署wordpress,如何访问网页?
来源:6-1 根据前面所学部署一个wordpress
积木_0004
2018-06-11
老师好,本地和vagrant启的虚拟机的网络这块理解的不太好,我是用第六章的Vagrantfile启的docker-host,然后在这个docker-host里分别获取了mysql:5.7和wordpress的镜像,并按照视频中的run的参数把容器启动。但是我用本地浏览器127.0.0.1:8080访问并不行。网络这块理解的不是很好。我在docker-host里用docker network inspect bridge看了下,172.17.0.2和172.17.0.3分别是我的mysql和wordpress, 我究竟应该用什么ip带8080端口能查看网页效果呢?
[vagrant@docker-host ~]$ docker network inspect bridge
[
{
"Name": "bridge",
"Id": "6f85055a8768f2285547996d20f5fb840854359a9324bb66ddeb5fec86f94110",
"Created": "2018-06-10T17:05:07.157633183Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"12de93375f7db39077630ca52a621626bcf0e9d3dd1ec55aeb0b6bf3665af20a": {
"Name": "mysql",
"EndpointID": "e84f6c4535e6f21868a251c7dba36491db86ff946fe723eac9f3fab0443d5638",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
},
"3c9c3b2cbce0a2cacfc56eb76585e7c608c1b8adc9dfab9933af6f9ea908042e": {
"Name": "zen_montalcini",
"EndpointID": "e1dd3d597ca49fdf80558c64d6ce31fce93931532c2c0ca0606dbec3db5e9dbd",
"MacAddress": "02:42:ac:11:00:03",
"IPv4Address": "172.17.0.3/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
1回答
-
麦兜搞IT
2018-06-12
如果您是在vagrant host里起的,那么就可以访问 vagrant host的 ip + 8080端口,当然前提是wordpress通过-p把 80映射到8080了
00
相似问题