我在Ubuntu 16.04和17.04中已经使用Docker了,现在也想在我的Macbook上使用它 - 因为我在容器中连接到网络时遇到了问题。
version: '2'
services:
shopware:
build: php
volumes:
- ./shopware:/var/www/shopware
links:
- sw_mysql:mysql
ports:
- "8083:80"
networks:
sw_docker:
ipv4_address: 10.50.111.46
sw_mysql:
build: mysql
env_file:
- .env
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PW}
MYSQL_USER: app
MYSQL_PASSWORD: app
MYSQL_DATABASE: shopware
networks:
sw_docker:
ipv4_address: 10.50.111.47
volumes:
- "./db_dump:/docker-entrypoint-initdb.d"
networks:
sw_docker:
driver: bridge
ipam:
driver: default
config:
- subnet: 10.50.111.0/24
gateway: 10.50.111.1
docker network inspect bridge
给了我更多信息,但网络似乎没有出现:
[
{
"Name": "bridge",
"Id": "6fac3c9cc2b55473a24e9b5b0e7827f14c06db17d274421c981c75ef41afd2a8",
"Created": "2017-10-31T20:01:31.479602065Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"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": {}
}
]
对于macOS的docker-compose.yml设置是否有特殊之处,或者是否缺少驱动程序?我认为使用docker会更容易,但我想在本地设置我的apache和mysql可能更容易。
有什么想法吗?我应该发布更多配置等吗?
docker network ls
NETWORK ID NAME DRIVER SCOPE
6fac3c9cc2b5 bridge bridge local
d86f077405cd host host local
a33452a03178 none null local
ae585b6d6ce0 swdocker_sw_docker bridge local