[英]Docker Login for AWS ECR failing with “Cannot connect to the Docker deamon…”
[英]Docker root dir cannot be found for nodes in Docker for AWS
我使用Docker for AWS創建了一個Docker swarm集群。 在這個集群的每個節點中,我發現Docker根目錄是/var/lib/docker
,但是,我在文件系統中找不到這個目錄。
docker info
顯示:
~ $ docker info
Containers: 7
Running: 7
Paused: 0
Stopped: 0
Images: 9
Server Version: 17.06.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: awslogs
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
NodeID: k8nw4j8bt0mhip541vurvd785
Is Manager: false
Node Address: 10.x.y.z
Manager Addresses:
10.x.y.z:2377
10.x.y.z:2377
10.x.y.z:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.36-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.293GiB
Name: ip-10-x-y-z.us-west-2.compute.internal
ID: 4YZB:UYHX:REW2:ENBZ:AAEW:BS6T:HB5B:OQCE:FRBU:DPXX:SJWV:GRGL
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 163
Goroutines: 233
System Time: 2018-06-13T07:04:01.824290758Z
EventsListeners: 5
Registry: https://index.docker.io/v1/
Labels:
os=linux
region=us-west-2
availability_zone=us-west-2a
instance_type=m3.large
node_type=worker
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
它清楚地顯示了Docker Root Dir
是/var/lib/docker
,但是,當我使用ls
,它說無法找到目錄:
~ $ sudo ls /var/lib/docker
ls: /var/lib/docker: No such file or directory
~ $ sudo ls -al /var/lib/
total 20
drwxr-xr-x 5 root root 4096 Jun 25 2017 .
drwxr-xr-x 1 root root 4096 Jun 27 2017 ..
drwxr-xr-x 2 root root 4096 Jun 25 2017 apk
drwxr-xr-x 2 root root 4096 Jun 25 2017 misc
drwxr-xr-x 2 root root 4096 Jun 25 2017 udhcpd
關於Docker的磁盤使用情況,Docker使用了超過2.3GB的磁盤
/ $ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 9 6 2.361GB 1.702GB (72%)
Containers 7 7 665.1kB 0B (0%)
Local Volumes 6 6 19.85MB 0B (0%)
關於文件系統使用情況, df
命令顯示使用2.9GB空間,這是預期的,因為僅Docker消耗超過2.3GB。
/ $ sudo df -h
Filesystem Size Used Available Use% Mounted on
overlay 19.7G 2.9G 15.8G 15% /
tmpfs 3.6G 0 3.6G 0% /dev
tmpfs 3.6G 0 3.6G 0% /sys/fs/cgroup
tmpfs 3.6G 161.2M 3.5G 4% /etc/group
tmpfs 3.6G 161.2M 3.5G 4% /etc/passwd
tmpfs 3.6G 161.2M 3.5G 4% /etc/shadow
/dev/xvdb1 19.7G 2.9G 15.8G 15% /etc/ssh
tmpfs 3.6G 161.2M 3.5G 4% /home/docker
/dev/xvdb1 19.7G 2.9G 15.8G 15% /var/log
/dev/xvdb1 19.7G 2.9G 15.8G 15% /etc/resolv.conf
/dev/xvdb1 19.7G 2.9G 15.8G 15% /etc/hostname
/dev/xvdb1 19.7G 2.9G 15.8G 15% /etc/hosts
shm 64.0M 0 64.0M 0% /dev/shm
tmpfs 746.8M 916.0K 745.9M 0% /var/run/docker.sock
tmpfs 3.6G 161.2M 3.5G 4% /usr/bin/docker
tmpfs 3.6G 0 3.6G 0% /proc/kcore
tmpfs 3.6G 0 3.6G 0% /proc/timer_list
tmpfs 3.6G 0 3.6G 0% /proc/sched_debug
tmpfs 3.6G 0 3.6G 0% /sys/firmware
同時,關於磁盤使用情況:
/ $ sudo du -h -d 1
0 ./sys
31.5M ./usr
1.8M ./etc
0 ./proc
12.0K ./home
216.0K ./sbin
4.0K ./tmp
8.0K ./run
4.0K ./root
1.4M ./bin
114.3M ./var
4.0K ./mnt
16.0K ./media
2.8M ./lib
0 ./dev
4.0K ./srv
152.2M .
du
報告只使用了152.2M磁盤,而/var
文件夾只使用了114.3M,似乎du
無法找到/ var / lib / docker,而Docker以某種方式存儲其數據(2.3 + GB) du
找不到。
如果我使用docker inspect
檢查此節點上的一個正在運行的容器,則會在/var/lib/docker
下顯示多個文件夾。
任何人都可以對原因有所了解嗎? 謝謝。
這是因為當您使用docker用戶ssh時,aws的docker使用shell容器( https://docs.docker.com/docker-for-aws/faqs/#what-are-the-editions-containers-running-after -deployment ),因此您實際上無法訪問根目錄所在的主機。
您可以通過特權容器訪問主機,首先使用docker用戶進行sshing,然后運行類似: docker run --rm -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.