41
34

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

docker-composeでDocker daemonに繋がらなくなったときの対処法

Posted at

環境:

  • Mac OSX 10.11.2
  • Docker Toolbox 1.9.1i

何をどうしたかサッパリ身に覚えが無いものの、docker-compose upをすると、以下の様なエラーが表示されるようになってしまいました。

ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.

docker-machine start defaultは当然実行済みなのでなんだろうと思いつつも、ひとまずdocker-machine env defaultをしてみようと思ったところ、今度は次のエラーが。

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "<<IP Address>>:2376": dial tcp <<IP Address>>:2376: i/o timeout
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.

TLSが無効になってるから、regenerate-certsしろとあります。参考:http://qiita.com/kooohei/items/d370701d6c39727334f3
なので、docker-machine regenerate-certs defaultをするわけですが、すると今度もエラー...

$ docker-machine regenerate-certs default
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Detecting the provisioner...
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.

docker-machine restartするも効果なし。
Issueにあるように、VirtualBoxの設定からHost-onlyを削除するも効果なし。
最終的には、以下で(恐らく)解決

  1. docker-machine stop default
  2. VirtualBoxの設定からHost-onlyのネットワークアダプタを削除 ←必要か不明
  3. 手動で以下をexport
$ export DOCKER_CERT_PATH=~/.docker/machine/machines/default/
$ export DOCKER_TLS_VERIFY="1"
$ export DOCKER_HOST="tcp://192.168.99.100:2376"
$ export DOCKER_MACHINE_NAME="default"

これで、docker-machine regenerate-certs defaultが通るようになりました。

41
34
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
41
34

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?