问题
I'm running the latest docker/ docker-machine on OSX Yosemite and VirtualBox and I'm trying to connect to a lein ring server running in a container from the host the loading is slow as in like Load time is over 1 min The following is my configuration
Docker 1.12.0 Docker Machine 0.8.0 VirtualBox 5.0.24
My Docker Machine
"ConfigVersion": 3, "Driver": { "IPAddress": "192.168.99.100", "MachineName": "default", "SSHUser": "docker", "SSHPort": 49478, "SSHKeyPath": "/Volumes/NASMAC/VMs/.docker/machine/machines/default/id_rsa", "StorePath": "/Volumes/NASMAC/VMs/.docker/machine", "SwarmMaster": false, "SwarmHost": "tcp://0.0.0.0:3376", "SwarmDiscovery": "", "VBoxManager": {}, "HostInterfaces": {}, "CPU": 1, "Memory": 1024, "DiskSize": 20000, "NatNicType": "82540EM", "Boot2DockerURL": "", "Boot2DockerImportVM": "", "HostDNSResolver": false, "HostOnlyCIDR": "192.168.99.1/24", "HostOnlyNicType": "82540EM", "HostOnlyPromiscMode": "deny", "UIType": "headless", "NoShare": false, "DNSProxy": true, "NoVTXCheck": false }, "DriverName": "virtualbox", "HostOptions": { "Driver": "", "Memory": 0, "Disk": 0, "EngineOptions": { "ArbitraryFlags": [], "Dns": null, "GraphDir": "", "Env": [], "Ipv6": false, "InsecureRegistry": [], "Labels": [], "LogLevel": "", "StorageDriver": "", "SelinuxEnabled": false, "TlsVerify": true, "RegistryMirror": [], "InstallURL": "https://get.docker.com" }, "SwarmOptions": { "IsSwarm": false, "Address": "", "Discovery": "", "Agent": false, "Master": false, "Host": "tcp://0.0.0.0:3376", "Image": "swarm:latest", "Strategy": "spread", "Heartbeat": 0, "Overcommit": 0, "ArbitraryFlags": [], "ArbitraryJoinFlags": [], "Env": null, "IsExperimental": false }, "AuthOptions": { "CertDir": "/Volumes/NASMAC/VMs/.docker/machine/certs", "CaCertPath": "/Volumes/NASMAC/VMs/.docker/machine/certs/ca.pem", "CaPrivateKeyPath": "/Volumes/NASMAC/VMs/.docker/machine/certs/ca-key.pem", "CaCertRemotePath": "", "ServerCertPath": "/Volumes/NASMAC/VMs/.docker/machine/machines/default/server.pem", "ServerKeyPath": "/Volumes/NASMAC/VMs/.docker/machine/machines/default/server-key.pem", "ClientKeyPath": "/Volumes/NASMAC/VMs/.docker/machine/certs/key.pem", "ServerCertRemotePath": "", "ServerKeyRemotePath": "", "ClientCertPath": "/Volumes/NASMAC/VMs/.docker/machine/certs/cert.pem", "ServerCertSANs": [], "StorePath": "/Volumes/NASMAC/VMs/.docker/machine/machines/default" } }, "Name": "default" }
My docker Image
{ "Id": "819132073e36a026222ad0da90899a0daf1e735ce0f8623202740b355556c136", "Created": "2016-08-28T23:35:03.957961657Z", "Path": "/bin/bash", "Args": [ "lein", "with-profile", "dev", "do", "start-dev" ], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 3586, "ExitCode": 0, "Error": "", "StartedAt": "2016-08-28T23:35:04.365339872Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:618b57a0e5d07030a3f869607928f5e167b53a6f250f76f88325799888dcac94", "ResolvConfPath": "/var/lib/docker/containers/819132073e36a026222ad0da90899a0daf1e735ce0f8623202740b355556c136/resolv.conf", "HostnamePath": "/var/lib/docker/containers/819132073e36a026222ad0da90899a0daf1e735ce0f8623202740b355556c136/hostname", "HostsPath": "/var/lib/docker/containers/819132073e36a026222ad0da90899a0daf1e735ce0f8623202740b355556c136/hosts", "LogPath": "/var/lib/docker/containers/819132073e36a026222ad0da90899a0daf1e735ce0f8623202740b355556c136/819132073e36a026222ad0da90899a0daf1e735ce0f8623202740b355556c136-json.log", "Name": "/lonely_ritchie", "RestartCount": 0, "Driver": "aufs", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/Users/kendallarneaud/Documents/Git/ngc-race-along.docker:/data" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "default", "PortBindings": { "3000/tcp": [ { "HostIp": "", "HostPort": "" } ], "9000/tcp": [ { "HostIp": "", "HostPort": "" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": true, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Name": "aufs", "Data": null }, "Mounts": [ { "Source": "/Users/kendallarneaud/Documents/Git/ngc-race-along.docker", "Destination": "/data", "Mode": "", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "819132073e36", "Domainname": "", "User": "", "AttachStdin": true, "AttachStdout": true, "AttachStderr": true, "ExposedPorts": { "3000/tcp": {}, "9000/tcp": {} }, "Tty": true, "OpenStdin": true, "StdinOnce": true, "Env": [ "no_proxy=*.local, 169.254/16", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "HOME=/root", "JAVA_HOME=/usr/lib/jvm/java-7-oracle", "LEIN_ROOT=true", "LANG=C.UTF-8", "PYTHON_VERSION=2.7.9" ], "Cmd": [ "/bin/bash", "lein", "with-profile", "dev", "do", "start-dev" ], "Image": "rand/docker-clojurescript:latest", "Volumes": null, "WorkingDir": "/data", "Entrypoint": null, "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "8b5479b9b22a6d653509c99f9b291593ca7664339666cf40bee55044f3c1d778", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "3000/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "32773" } ], "9000/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "32772" } ] }, "SandboxKey": "/var/run/docker/netns/8b5479b9b22a", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "d4164a411f5ca1992eb724c4cd5cb2f013a1eb909b6d3e5f395d07df84ff34f2", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:02", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "fb82d366a9a2ad010bda7cdf4e6cb33f083a678756cfdfed01f90d3d2c317dfa", "EndpointID": "d4164a411f5ca1992eb724c4cd5cb2f013a1eb909b6d3e5f395d07df84ff34f2", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02" } } } }
I'm not sure what other information I am to submit to debug this situation. Is there that can be done to improve performance?
回答1:
To speed this up you can also use http://docker-sync.io - it has been specifically build for this case under OSX.
回答2:
Mounting of home (mac) folders in VirtualBox is known to be extremely slow with data transfer. Try using Docker for Mac instead, or copy your content to a named volume. e.g.:
docker create volume --name myvol
docker run --rm --name data-container -v myvol:/data alpine top
docker cp dir/with/files data-container:/data
docker rm -f data-container
This gives you a volume myvol
which you can mount on any container. The volume data is kept in the VirtualBox host.
来源:https://stackoverflow.com/questions/39197229/slow-network-performance-in-docker-container