ようへい

2018年6月6日水曜日

Docker でのエラーあれこれ対処法

主に Docker Toolbox での話です。

no such host

エラー
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host.
原因
ホストが引けていません
対処
DNSを追加します
# echo "nameserver 8.8.8.8" >> /etc/resolv.conf
プロキシの設定が必要な環境なら .bash_profile に設定して再読込するか、環境変数に設定する
# export HTTP_PROXY=http://username:password@host:port
# export HTTPS_PROXY=http://username:password@host:port
curl https://registry-1.docker.io/v2/ とかやって、データ返ってくることを確認する
# curl https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}

request canceled while waiting for connection

エラー
Error response from daemon: Get https://hub.docker.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
対処
docker サービスを再起動したら解消された
# docker login
Username: xxxxx
Password:
Error response from daemon: Get https://hub.docker.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
# /etc/init.d/docker restart
# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: xxxxx
Password:
Login Succeeded

cgroups: cannot find cgroup mount destination: unknown

エラー
docker: Error response from daemon: cgroups: cannot find cgroup mount destination: unknown.
ERRO[0001] error waiting for container: context canceled
対処
# mkdir /sys/fs/cgroup/systemd
# mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
参考
docker: Error response from daemon: cgroups: cannot found cgroup mount destination: unknown. · Issue #1301 · boot2docker/boot2docker · GitHub
https://github.com/boot2docker/boot2docker/issues/1301
関連記事