如何离线运行mac上的docker

当我在mac上安装docker时,它从我的intranetnetworking中获取了一个ip。 之后,当我切换到不同的networking,它显示我错误

$ bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh' Starting "default"... (default) Waiting for an IP... Too many retries waiting for SSH to be available. Last error: Maximum number of retries (60) exceeded Regenerate TLS machine certs? Warning: this is irreversible. (y/n): Regenerating TLS certificates Detecting the provisioner... Error getting SSH command: Something went wrong running an SSH command! command : cat /etc/os-release err : exit status 255 output : Error checking TLS connection: Something went wrong running an SSH command! command : ip addr show dev eth1 err : exit status 255 output : ## . ## ## ## == ## ## ## ## ## === /"""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\_______/ Error getting IP address: Something went wrong running an SSH command! command : ip addr show dev eth1 err : exit status 255 output : docker is configured to use the default machine with IP For help getting started, check out the docs at https://docs.docker.com 

我明白,有一些相关的网关,configuration在“默认”我跑了

 docker-machine rm default (this deleted all my previously downloaded images) docker-machine create --driver virtualbox default 

离线和重新启动docker机默认了内置。 之后,我去上网,试图下载一个图像。 但是我得到连接错误。

 $ docker run -t -i --name myFirstContainer ubuntu:14.04 /bin/bash Unable to find image 'ubuntu:14.04' locally Pulling repository docker.io/library/ubuntu Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/ubuntu/images. You may want to check your internet connection or if you are behind a proxy. 

我想这是因为当我离线时,没有界面被分配到“默认”

 $ docker network inspect bridge [ { "Name": "bridge", "Id": "df562e1cae477be7d2dc09a30ee21b0871a2202731506d3f6db3df9c1abb4cad", "Scope": "local", "Driver": "bridge", "IPAM": { "Driver": "default", "Config": [ { "Subnet": "172.17.0.0/16" } ] }, "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" } } ] 

状态,当我重新连接到networking,并重build“默认”

 $ docker-machine create --driver virtualbox default Running pre-create checks... (default) Default Boot2Docker ISO is out-of-date, downloading the latest release... (default) Latest release for github.com/boot2docker/boot2docker is v1.10.0 (default) Downloading /Users/tt/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v1.10.0/boot2docker.iso... (default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100% Creating machine... (default) Copying /Users/tt/.docker/machine/cache/boot2docker.iso to /Users/tt/.docker/machine/machines/default/boot2docker.iso... (default) Creating VirtualBox VM... (default) Creating SSH key... (default) Starting the VM... (default) Waiting for an IP... Waiting for machine to be running, this may take a few minutes... Machine is running, waiting for SSH to be available... Detecting operating system of created instance... Detecting the provisioner... Provisioning with boot2docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... This machine has been allocated an IP address, but Docker Machine could not reach it successfully. SSH for the machine should still work, but connecting to exposed ports, such as the Docker daemon port (usually <ip>:2376), may not work properly. You may need to add the route manually, or use another related workaround. This could be due to a VPN, proxy, or host file configuration issue. You also might want to clear any VirtualBox host only interfaces you are not using. Checking connection to Docker... Docker is up and running! To see how to connect Docker to this machine, run: docker-machine env default $ docker network inspect bridge [ { "Name": "bridge", "Id": "307267097a1845e6ac7b2a6a67bf800b8cda05f036c649a92af59a44689a55ab", "Scope": "local", "Driver": "bridge", "IPAM": { "Driver": "default", "Config": [ { "Subnet": "172.17.0.0/16" } ] }, "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" } } ] $ docker run -t -i --name myFirstContainer ubuntu:14.04 /bin/bash Unable to find image 'ubuntu:14.04' locally 14.04: Pulling from library/ubuntu 8387d9ff0016: Pull complete 3b52deaaf0ed: Pull complete 4bd501fad6de: Pull complete a3ed95caeb02: Pull complete Digest: sha256:0844055d30c0cad5ac58097597a94640b0102f47d6fa972c94b7c129d87a44b7 Status: Downloaded newer image for ubuntu:14.04 

无论如何,即使当我切换networking或当我离线时,我可以无缝运行docker工人吗?