我试图按 链接中 所述配置 Docker守护程序端口 :
cat /etc/docker/daemon.json { "debug": "true", "hosts": "tcp://127.0.0.1:5000" } # Service docker status docker stop/waiting # service docker start start: Job failed to start Docker version: 17.04
我启用了 调试日志 来检查启动Docker服务的问题,并从以下位置的日志中了解到/var/log/upstart/docker.log:
/var/log/upstart/docker.log
Waiting for /var/run/docker.sock unable to configure the Docker daemon with file /etc/docker/daemon.json: json: cannot unmarshal string into Go value of type bool
是什么 导致Docker容器启动的问题? 配置文件有问题daemon.json吗?
daemon.json
建议更改后的问题:
cat /etc/docker/daemon.json { "debug": true, "hosts": "tcp://127.0.0.1:5000" }
错误:
Waiting for /var/run/docker.sock unable to configure the Docker daemon with file /etc/docker/daemon.json: json: cannot unmarshal string into Go value of type []string
所以我将其更改为:
cat /etc/docker/daemon.json { "debug": true, "hosts": ["tcp://127.0.0.1:5000"] }
和调试日志:
# cat /var/log/upstart/docker.log Waiting for /var/run/docker.sock time="2017-04-29T21:49:39.082025019+05:30" level=warning msg="[!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting --tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!]" time="2017-04-29T21:49:39.087462580+05:30" level=debug msg="Listener created for HTTP on tcp (127.0.0.1:5000)" time="2017-04-29T21:49:39.091623380+05:30" level=info msg="libcontainerd: new containerd process, pid: 28412" DEBU[0000] containerd: read past events count=0 DEBU[0000] containerd: supervisor running cpus=1 memory=3953 runtime=docker-runc runtimeArgs=[] stateDir="/var/run/docker/libcontainerd/containerd" DEBU[0000] containerd: grpc api on /var/run/docker/libcontainerd/docker-containerd.sock Waiting for /var/run/docker.sock time="2017-04-29T21:49:39.594179140+05:30" level=debug msg="libcontainerd: containerd health check returned error: rpc error: code = 14 desc = grpc: the connection is unavailable" Waiting for /var/run/docker.sock Waiting for /var/run/docker.sock time="2017-04-29T21:49:40.093473005+05:30" level=debug msg="libcontainerd: containerd health check returned error: rpc error: code = 14 desc = grpc: the connection is unavailable" time="2017-04-29T21:49:40.103148602+05:30" level=debug msg="Using default logging driver json-file" time="2017-04-29T21:49:40.104791557+05:30" level=debug msg="Golang's threads limit set to 56610" time="2017-04-29T21:49:40.120505279+05:30" level=info msg="[graphdriver] using prior storage driver: aufs" time="2017-04-29T21:49:40.121399341+05:30" level=debug msg="Using graph driver aufs" time="2017-04-29T21:49:40.127259410+05:30" level=debug msg="Max Concurrent Downloads: 3" time="2017-04-29T21:49:40.127366059+05:30" level=debug msg="Max Concurrent Uploads: 5" time="2017-04-29T21:49:40.139747219+05:30" level=info msg="Graph migration to content-addressability took 0.00 seconds" time="2017-04-29T21:49:40.140011955+05:30" level=warning msg="Your kernel does not support swap memory limit" time="2017-04-29T21:49:40.140100084+05:30" level=warning msg="Your kernel does not support cgroup rt period" time="2017-04-29T21:49:40.140216600+05:30" level=warning msg="Your kernel does not support cgroup rt runtime" time="2017-04-29T21:49:40.140342372+05:30" level=warning msg="mountpoint for pids not found" time="2017-04-29T21:49:40.140594173+05:30" level=info msg="Loading containers: start." time="2017-04-29T21:49:40.141501935+05:30" level=debug msg="Loaded container 0102006e71695802c5f21edbb9dc4776d4c291d28c8db21fbc30144c7ee5ac58" time="2017-04-29T21:49:40.142853279+05:30" level=debug msg="Loaded container 01c63f92586b3e792b0bcf5c9081126c71ce816ad4d38031e2bd2019ba536461" time="2017-04-29T21:49:40.143269945+05:30" level=debug msg="Loaded container 0523a71851447b55b18fe3c8e9ac904837bd5062cc237f7cb507a9e4e3cda410" ** REMOVED THE CONTAINERS LOADING INFO ** time="2017-04-29T21:49:40.165085939+05:30" level=debug msg="Loaded container ff01985e70fe0d14210c88b768b2ea521d4521d376e5df0e90895533e577b92e" Waiting for /var/run/docker.sock time="2017-04-29T21:49:40.289009591+05:30" level=debug msg="Option Experimental: false" time="2017-04-29T21:49:40.289131532+05:30" level=debug msg="Option DefaultDriver: bridge" time="2017-04-29T21:49:40.289205442+05:30" level=debug msg="Option DefaultNetwork: bridge" time="2017-04-29T21:49:40.294576340+05:30" level=info msg="Firewalld running: false" time="2017-04-29T21:49:40.297766934+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER]" time="2017-04-29T21:49:40.299341976+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -D OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER]" time="2017-04-29T21:49:40.301053126+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -D OUTPUT -m addrtype --dst-type LOCAL -j DOCKER]" time="2017-04-29T21:49:40.302616266+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -D PREROUTING]" time="2017-04-29T21:49:40.304229207+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -D OUTPUT]" time="2017-04-29T21:49:40.305711736+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -F DOCKER]" time="2017-04-29T21:49:40.307077262+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -X DOCKER]" time="2017-04-29T21:49:40.308535928+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -F DOCKER]" time="2017-04-29T21:49:40.309902224+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -X DOCKER]" time="2017-04-29T21:49:40.311637703+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -F DOCKER-ISOLATION]" time="2017-04-29T21:49:40.313500303+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -X DOCKER-ISOLATION]" time="2017-04-29T21:49:40.315093100+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -n -L DOCKER]" time="2017-04-29T21:49:40.316612016+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -N DOCKER]" time="2017-04-29T21:49:40.318047831+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -n -L DOCKER]" time="2017-04-29T21:49:40.319496142+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -n -L DOCKER-ISOLATION]" time="2017-04-29T21:49:40.320978680+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C DOCKER-ISOLATION -j RETURN]" time="2017-04-29T21:49:40.322453938+05:30" level=debug msg="/sbin/iptables, [--wait -I DOCKER-ISOLATION -j RETURN]" time="2017-04-29T21:49:40.327870386+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE]" time="2017-04-29T21:49:40.329395686+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C DOCKER -i docker0 -j RETURN]" time="2017-04-29T21:49:40.330870634+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -I DOCKER -i docker0 -j RETURN]" time="2017-04-29T21:49:40.332401751+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -i docker0 -o docker0 -j DROP]" time="2017-04-29T21:49:40.333933984+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -i docker0 -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.335444643+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -i docker0 ! -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.337019261+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C PREROUTING -m addrtype --dst-type LOCAL -j DOCKER]" time="2017-04-29T21:49:40.338699953+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER]" time="2017-04-29T21:49:40.340319708+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C OUTPUT -m addrtype --dst-type LOCAL -j DOCKER ! --dst 127.0.0.0/8]" time="2017-04-29T21:49:40.342595449+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -A OUTPUT -m addrtype --dst-type LOCAL -j DOCKER ! --dst 127.0.0.0/8]" time="2017-04-29T21:49:40.344321469+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -j DOCKER]" time="2017-04-29T21:49:40.345835836+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -j DOCKER]" time="2017-04-29T21:49:40.347371940+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT]" time="2017-04-29T21:49:40.348970025+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT]" time="2017-04-29T21:49:40.350514996+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -j DOCKER-ISOLATION]" Waiting for /var/run/docker.sock time="2017-04-29T21:49:40.354889362+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -j DOCKER-ISOLATION]" time="2017-04-29T21:49:40.356534823+05:30" level=debug msg="/sbin/iptables, [--wait -I FORWARD -j DOCKER-ISOLATION]" time="2017-04-29T21:49:40.358137686+05:30" level=debug msg="Network (cdd354f) restored" time="2017-04-29T21:49:40.369466443+05:30" level=debug msg="Allocating IPv4 pools for network bridge (cdd354f255bdc31986952e845957b04baa477ed7362b4b3b7ed606c31850d68a)" time="2017-04-29T21:49:40.369595546+05:30" level=debug msg="RequestPool(LocalDefault, 172.17.0.0/16, , map[], false)" time="2017-04-29T21:49:40.369730759+05:30" level=debug msg="RequestAddress(LocalDefault/172.17.0.0/16, 172.17.0.1, map[RequestAddressType:com.docker.network.gateway])" time="2017-04-29T21:49:40.371387634+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE]" time="2017-04-29T21:49:40.373112693+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -D POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE]" time="2017-04-29T21:49:40.374880382+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C DOCKER -i docker0 -j RETURN]" time="2017-04-29T21:49:40.376591245+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -D DOCKER -i docker0 -j RETURN]" time="2017-04-29T21:49:40.378326734+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -i docker0 -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.380015825+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -i docker0 -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.381638134+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -i docker0 ! -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.383258380+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -i docker0 ! -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.384970620+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -j DOCKER]" time="2017-04-29T21:49:40.386558723+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -j DOCKER]" time="2017-04-29T21:49:40.388624059+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -o docker0 -j DOCKER]" time="2017-04-29T21:49:40.390622271+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT]" time="2017-04-29T21:49:40.392615245+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT]" time="2017-04-29T21:49:40.394577019+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT]" time="2017-04-29T21:49:40.398027079+05:30" level=debug msg="releasing IPv4 pools from network bridge (cdd354f255bdc31986952e845957b04baa477ed7362b4b3b7ed606c31850d68a)" time="2017-04-29T21:49:40.398174850+05:30" level=debug msg="ReleaseAddress(LocalDefault/172.17.0.0/16, 172.17.0.1)" time="2017-04-29T21:49:40.398258452+05:30" level=debug msg="ReleasePool(LocalDefault/172.17.0.0/16)" time="2017-04-29T21:49:40.400734572+05:30" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address" time="2017-04-29T21:49:40.400866715+05:30" level=debug msg="Allocating IPv4 pools for network bridge (f729ff1f8c660b13bc5567d8a30cde03698b4df6a4d0fdbced201a7452fbf0f0)" time="2017-04-29T21:49:40.400921339+05:30" level=debug msg="RequestPool(LocalDefault, 172.17.0.0/16, , map[], false)" time="2017-04-29T21:49:40.400984209+05:30" level=debug msg="RequestAddress(LocalDefault/172.17.0.0/16, 172.17.0.1, map[RequestAddressType:com.docker.network.gateway])" time="2017-04-29T21:49:40.401150859+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE]" time="2017-04-29T21:49:40.402745792+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -I POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE]" time="2017-04-29T21:49:40.404360129+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C DOCKER -i docker0 -j RETURN]" time="2017-04-29T21:49:40.405955436+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -I DOCKER -i docker0 -j RETURN]" time="2017-04-29T21:49:40.407494814+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -i docker0 -o docker0 -j DROP]" time="2017-04-29T21:49:40.409144994+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -i docker0 -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.410904462+05:30" level=debug msg="/sbin/iptables, [--wait -I FORWARD -i docker0 -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.412607157+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -i docker0 ! -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.414338440+05:30" level=debug msg="/sbin/iptables, [--wait -I FORWARD -i docker0 ! -o docker0 -j ACCEPT]" time="2017-04-29T21:49:40.415979126+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C PREROUTING -m addrtype --dst-type LOCAL -j DOCKER]" time="2017-04-29T21:49:40.417726152+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C PREROUTING -m addrtype --dst-type LOCAL -j DOCKER]" time="2017-04-29T21:49:40.419367167+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C OUTPUT -m addrtype --dst-type LOCAL -j DOCKER ! --dst 127.0.0.0/8]" time="2017-04-29T21:49:40.421122358+05:30" level=debug msg="/sbin/iptables, [--wait -t nat -C OUTPUT -m addrtype --dst-type LOCAL -j DOCKER ! --dst 127.0.0.0/8]" time="2017-04-29T21:49:40.422856895+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -j DOCKER]" time="2017-04-29T21:49:40.424550825+05:30" level=debug msg="/sbin/iptables, [--wait -I FORWARD -o docker0 -j DOCKER]" time="2017-04-29T21:49:40.426107430+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT]" time="2017-04-29T21:49:40.427991143+05:30" level=debug msg="/sbin/iptables, [--wait -I FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT]" time="2017-04-29T21:49:40.429645428+05:30" level=debug msg="/sbin/iptables, [--wait -t filter -C FORWARD -j DOCKER-ISOLATION]" time="2017-04-29T21:49:40.431266204+05:30" level=debug msg="/sbin/iptables, [--wait -D FORWARD -j DOCKER-ISOLATION]" time="2017-04-29T21:49:40.432879578+05:30" level=debug msg="/sbin/iptables, [--wait -I FORWARD -j DOCKER-ISOLATION]" Waiting for /var/run/docker.sock time="2017-04-29T21:49:40.500868327+05:30" level=info msg="Loading containers: done." time="2017-04-29T21:49:40.519559145+05:30" level=info msg="Daemon has completed initialization" time="2017-04-29T21:49:40.519681055+05:30" level=info msg="Docker daemon" commit=4845c56 graphdriver=aufs version=17.04.0-ce time="2017-04-29T21:49:40.519845570+05:30" level=debug msg="Registering routers" time="2017-04-29T21:49:40.519892553+05:30" level=debug msg="Registering GET, /containers/{name:.*}/checkpoints" time="2017-04-29T21:49:40.520055568+05:30" level=debug msg="Registering POST, /containers/{name:.*}/checkpoints" time="2017-04-29T21:49:40.520182547+05:30" level=debug msg="Registering DELETE, /containers/{name}/checkpoints/{checkpoint}" time="2017-04-29T21:49:40.520360059+05:30" level=debug msg="Registering HEAD, /containers/{name:.*}/archive" time="2017-04-29T21:49:40.520479299+05:30" level=debug msg="Registering GET, /containers/json" time="2017-04-29T21:49:40.520574487+05:30" level=debug msg="Registering GET, /containers/{name:.*}/export" time="2017-04-29T21:49:40.520683367+05:30" level=debug msg="Registering GET, /containers/{name:.*}/changes" time="2017-04-29T21:49:40.520823502+05:30" level=debug msg="Registering GET, /containers/{name:.*}/json" time="2017-04-29T21:49:40.520936230+05:30" level=debug msg="Registering GET, /containers/{name:.*}/top" time="2017-04-29T21:49:40.521036359+05:30" level=debug msg="Registering GET, /containers/{name:.*}/logs" time="2017-04-29T21:49:40.521146161+05:30" level=debug msg="Registering GET, /containers/{name:.*}/stats" time="2017-04-29T21:49:40.521313628+05:30" level=debug msg="Registering GET, /containers/{name:.*}/attach/ws" time="2017-04-29T21:49:40.521421473+05:30" level=debug msg="Registering GET, /exec/{id:.*}/json" time="2017-04-29T21:49:40.521516457+05:30" level=debug msg="Registering GET, /containers/{name:.*}/archive" time="2017-04-29T21:49:40.521620140+05:30" level=debug msg="Registering POST, /containers/create" time="2017-04-29T21:49:40.521745578+05:30" level=debug msg="Registering POST, /containers/{name:.*}/kill" time="2017-04-29T21:49:40.521860358+05:30" level=debug msg="Registering POST, /containers/{name:.*}/pause" time="2017-04-29T21:49:40.521964539+05:30" level=debug msg="Registering POST, /containers/{name:.*}/unpause" time="2017-04-29T21:49:40.522067959+05:30" level=debug msg="Registering POST, /containers/{name:.*}/restart" time="2017-04-29T21:49:40.522167019+05:30" level=debug msg="Registering POST, /containers/{name:.*}/start" time="2017-04-29T21:49:40.522308397+05:30" level=debug msg="Registering POST, /containers/{name:.*}/stop" time="2017-04-29T21:49:40.522414580+05:30" level=debug msg="Registering POST, /containers/{name:.*}/wait" time="2017-04-29T21:49:40.522514975+05:30" level=debug msg="Registering POST, /containers/{name:.*}/resize" time="2017-04-29T21:49:40.522619004+05:30" level=debug msg="Registering POST, /containers/{name:.*}/attach" time="2017-04-29T21:49:40.522787092+05:30" level=debug msg="Registering POST, /containers/{name:.*}/copy" time="2017-04-29T21:49:40.522894615+05:30" level=debug msg="Registering POST, /containers/{name:.*}/exec" time="2017-04-29T21:49:40.523003923+05:30" level=debug msg="Registering POST, /exec/{name:.*}/start" time="2017-04-29T21:49:40.523107351+05:30" level=debug msg="Registering POST, /exec/{name:.*}/resize" time="2017-04-29T21:49:40.523264006+05:30" level=debug msg="Registering POST, /containers/{name:.*}/rename" time="2017-04-29T21:49:40.523376319+05:30" level=debug msg="Registering POST, /containers/{name:.*}/update" time="2017-04-29T21:49:40.523513783+05:30" level=debug msg="Registering POST, /containers/prune" time="2017-04-29T21:49:40.523612647+05:30" level=debug msg="Registering PUT, /containers/{name:.*}/archive" time="2017-04-29T21:49:40.523828369+05:30" level=debug msg="Registering DELETE, /containers/{name:.*}" time="2017-04-29T21:49:40.523955417+05:30" level=debug msg="Registering GET, /images/json" time="2017-04-29T21:49:40.524052679+05:30" level=debug msg="Registering GET, /images/search" time="2017-04-29T21:49:40.524136911+05:30" level=debug msg="Registering GET, /images/get" time="2017-04-29T21:49:40.524247693+05:30" level=debug msg="Registering GET, /images/{name:.*}/get" time="2017-04-29T21:49:40.524372724+05:30" level=debug msg="Registering GET, /images/{name:.*}/history" time="2017-04-29T21:49:40.524487290+05:30" level=debug msg="Registering GET, /images/{name:.*}/json" time="2017-04-29T21:49:40.524597100+05:30" level=debug msg="Registering POST, /commit" time="2017-04-29T21:49:40.524677000+05:30" level=debug msg="Registering POST, /images/load" time="2017-04-29T21:49:40.524786382+05:30" level=debug msg="Registering POST, /images/create" time="2017-04-29T21:49:40.524879353+05:30" level=debug msg="Registering POST, /images/{name:.*}/push" time="2017-04-29T21:49:40.524991660+05:30" level=debug msg="Registering POST, /images/{name:.*}/tag" time="2017-04-29T21:49:40.525104838+05:30" level=debug msg="Registering POST, /images/prune" time="2017-04-29T21:49:40.525226759+05:30" level=debug msg="Registering DELETE, /images/{name:.*}" time="2017-04-29T21:49:40.525335549+05:30" level=debug msg="Registering OPTIONS, /{anyroute:.*}" time="2017-04-29T21:49:40.525435401+05:30" level=debug msg="Registering GET, /_ping" time="2017-04-29T21:49:40.525511894+05:30" level=debug msg="Registering GET, /events" time="2017-04-29T21:49:40.525591165+05:30" level=debug msg="Registering GET, /info" time="2017-04-29T21:49:40.525669340+05:30" level=debug msg="Registering GET, /version" time="2017-04-29T21:49:40.525814930+05:30" level=debug msg="Registering GET, /system/df" time="2017-04-29T21:49:40.525897277+05:30" level=debug msg="Registering POST, /auth" time="2017-04-29T21:49:40.525970337+05:30" level=debug msg="Registering GET, /volumes" time="2017-04-29T21:49:40.526057298+05:30" level=debug msg="Registering GET, /volumes/{name:.*}" time="2017-04-29T21:49:40.526163662+05:30" level=debug msg="Registering POST, /volumes/create" time="2017-04-29T21:49:40.526353639+05:30" level=debug msg="Registering POST, /volumes/prune" time="2017-04-29T21:49:40.526442022+05:30" level=debug msg="Registering DELETE, /volumes/{name:.*}" time="2017-04-29T21:49:40.526546136+05:30" level=debug msg="Registering POST, /build" time="2017-04-29T21:49:40.526623235+05:30" level=debug msg="Registering POST, /swarm/init" time="2017-04-29T21:49:40.526737579+05:30" level=debug msg="Registering POST, /swarm/join" time="2017-04-29T21:49:40.526819211+05:30" level=debug msg="Registering POST, /swarm/leave" time="2017-04-29T21:49:40.526899446+05:30" level=debug msg="Registering GET, /swarm" time="2017-04-29T21:49:40.526980042+05:30" level=debug msg="Registering GET, /swarm/unlockkey" time="2017-04-29T21:49:40.527069861+05:30" level=debug msg="Registering POST, /swarm/update" time="2017-04-29T21:49:40.527158981+05:30" level=debug msg="Registering POST, /swarm/unlock" time="2017-04-29T21:49:40.527342136+05:30" level=debug msg="Registering GET, /services" time="2017-04-29T21:49:40.527474641+05:30" level=debug msg="Registering GET, /services/{id}" time="2017-04-29T21:49:40.527609687+05:30" level=debug msg="Registering POST, /services/create" time="2017-04-29T21:49:40.527758523+05:30" level=debug msg="Registering POST, /services/{id}/update" time="2017-04-29T21:49:40.527871673+05:30" level=debug msg="Registering DELETE, /services/{id}" time="2017-04-29T21:49:40.527970912+05:30" level=debug msg="Registering GET, /services/{id}/logs" time="2017-04-29T21:49:40.528072255+05:30" level=debug msg="Registering GET, /nodes" time="2017-04-29T21:49:40.528151801+05:30" level=debug msg="Registering GET, /nodes/{id}" time="2017-04-29T21:49:40.528287417+05:30" level=debug msg="Registering DELETE, /nodes/{id}" time="2017-04-29T21:49:40.528390020+05:30" level=debug msg="Registering POST, /nodes/{id}/update" time="2017-04-29T21:49:40.528493003+05:30" level=debug msg="Registering GET, /tasks" time="2017-04-29T21:49:40.528572710+05:30" level=debug msg="Registering GET, /tasks/{id}" time="2017-04-29T21:49:40.528689980+05:30" level=debug msg="Registering GET, /secrets" time="2017-04-29T21:49:40.528796825+05:30" level=debug msg="Registering POST, /secrets/create" time="2017-04-29T21:49:40.528884054+05:30" level=debug msg="Registering DELETE, /secrets/{id}" time="2017-04-29T21:49:40.528992153+05:30" level=debug msg="Registering GET, /secrets/{id}" time="2017-04-29T21:49:40.529100356+05:30" level=debug msg="Registering POST, /secrets/{id}/update" time="2017-04-29T21:49:40.529246933+05:30" level=debug msg="Registering GET, /plugins" time="2017-04-29T21:49:40.529333481+05:30" level=debug msg="Registering GET, /plugins/{name:.*}/json" time="2017-04-29T21:49:40.529433799+05:30" level=debug msg="Registering GET, /plugins/privileges" time="2017-04-29T21:49:40.529532846+05:30" level=debug msg="Registering DELETE, /plugins/{name:.*}" time="2017-04-29T21:49:40.529640124+05:30" level=debug msg="Registering POST, /plugins/{name:.*}/enable" time="2017-04-29T21:49:40.529776734+05:30" level=debug msg="Registering POST, /plugins/{name:.*}/disable" time="2017-04-29T21:49:40.529884453+05:30" level=debug msg="Registering POST, /plugins/pull" time="2017-04-29T21:49:40.529979852+05:30" level=debug msg="Registering POST, /plugins/{name:.*}/push" time="2017-04-29T21:49:40.530083752+05:30" level=debug msg="Registering POST, /plugins/{name:.*}/upgrade" time="2017-04-29T21:49:40.530177424+05:30" level=debug msg="Registering POST, /plugins/{name:.*}/set" time="2017-04-29T21:49:40.530348200+05:30" level=debug msg="Registering POST, /plugins/create" time="2017-04-29T21:49:40.530432901+05:30" level=debug msg="Registering GET, /networks" time="2017-04-29T21:49:40.530518503+05:30" level=debug msg="Registering GET, /networks/" time="2017-04-29T21:49:40.530599687+05:30" level=debug msg="Registering GET, /networks/{id:.+}" time="2017-04-29T21:49:40.530751284+05:30" level=debug msg="Registering POST, /networks/create" time="2017-04-29T21:49:40.530853286+05:30" level=debug msg="Registering POST, /networks/{id:.*}/connect" time="2017-04-29T21:49:40.530960464+05:30" level=debug msg="Registering POST, /networks/{id:.*}/disconnect" time="2017-04-29T21:49:40.531072661+05:30" level=debug msg="Registering POST, /networks/prune" time="2017-04-29T21:49:40.531154778+05:30" level=debug msg="Registering DELETE, /networks/{id:.*}" time="2017-04-29T21:49:40.531568754+05:30" level=info msg="API listen on 127.0.0.1:5000" Waiting for /var/run/docker.sock Waiting for /var/run/docker.sock Waiting for /var/run/docker.sock Waiting for /var/run/docker.sock Waiting for /var/run/docker.sock Waiting for /var/run/docker.sock Waiting for /var/run/docker.sock .....
现在, Docker容器正在等待无限期。 是什么导致此问题?
能够通过dockerd手动启动:
#dockerd -H tcp://127.0.0.1:5000 & [1] 31661 root@labadmin-VirtualBox:/etc/docker# WARN[0000] [!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting --tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!] INFO[0000] libcontainerd: new containerd process, pid: 31665 WARN[0000] containerd: low RLIMIT_NOFILE changing to max current=1024 max=4096 INFO[0001] [graphdriver] using prior storage driver: aufs INFO[0001] Graph migration to content-addressability took 0.00 seconds WARN[0001] Your kernel does not support swap memory limit WARN[0001] Your kernel does not support cgroup rt period WARN[0001] Your kernel does not support cgroup rt runtime WARN[0001] mountpoint for pids not found INFO[0001] Loading containers: start. INFO[0001] Firewalld running: false INFO[0001] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address INFO[0001] Loading containers: done. INFO[0001] Daemon has completed initialization INFO[0001] Docker daemon commit=4845c56 graphdriver=aufs version=17.04.0-ce INFO[0001] API listen on 127.0.0.1:5000 # netstat -tunlp | grep -i 5000 tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 31661/dockerd
这是Dan Low提供的答案的补充。
配置Docker守护程序端口有两种方法:
在 / etc / default / docker 文件中配置:
DOCKER_OPTS="-H tcp://127.0.0.1:5000 -H unix:///var/run/docker.sock"
在 /etc/docker/daemon.json中 配置:
{
“debug”: true, “hosts”: [“tcp://127.0.0.1:5000”, “unix:///var/run/docker.sock”] }
配置端口后,重新启动Docker服务。
如果未配置Docker默认套接字,则可能会出现问题中提到的类似问题,即 Docker将等待无限期 。
注意:但不要同时在 两个 配置文件中进行配置。可能会发生以下错误:
Waiting for /var/run/docker.sock unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [tcp://127.0.0.1:5000 unix:///var/run/docker.sock], from file: tcp://127.0.0.1:5000)
其原因将两个的 用户端口[TCP://127.0.0.1:5000] 和 默认多克尔插座[UNIX:///var/run/docker.sock] 是用户端口使得接入到 多克尔的API 而默认套接字启用CLI。如果/etc/default/docker文件中未提及默认端口[unix:///var/run/docker.sock],则可能会发生以下错误:
/etc/default/docker
# docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
该错误不是因为Docker容器未运行,而是因为未启用默认Docker套接字。
这适用于Docker 17.04版本,并且可能因不同版本的Docker而有所不同。