Docker ContainerID不可用

时间:2016-10-20 07:43:27

标签: docker docker-machine docker-registry

我的容器会多次自动重启,并出现以下错误。容器与ec2实例上的chef一起运行。这是日志说

time="2016-10-19T23:23:36.382529790Z" level=info msg="GET /v1.16/containers/container1/json"
time="2016-10-19T23:23:36.382715521Z" level=error msg="Handler for GET /v1.16/containers/container1/json returned error: no such id: container1"
time="2016-10-19T23:23:36.382746955Z" level=error msg="HTTP Error" err="no such id: container1" statusCode=404
time="2016-10-19T23:23:36.383675061Z" level=info msg="GET /v1.16/containers/container1/json"
time="2016-10-19T23:23:36.383781507Z" level=error msg="Handler for GET /v1.16/containers/container1/json returned error: no such id: container1"
time="2016-10-19T23:23:36.383807920Z" level=error msg="HTTP Error" err="no such id: container1" statusCode=404
time="2016-10-19T23:23:36.384686602Z" level=info msg="GET /v1.16/containers/container1/json"

> Docker版本

docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5/1.9.1
 Built:
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5/1.9.1
 Built:
 OS/Arch:      linux/amd64

> Docker Info

docker info
Containers: 1
Images: 50
Server Version: 1.9.1
Storage Driver: devicemapper
 Pool Name: docker-202:1-263798-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 107.4 GB
 Backing Filesystem:
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 5.981 GB
 Data Space Total: 107.4 GB
 Data Space Available: 40.37 GB
 Metadata Space Used: 4.989 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.142 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.1.13-19.30.amzn1.x86_64
Operating System: Amazon Linux AMI 2015.09
CPUs: 1
Total Memory: 3.679 GiB
Name: container1
ID: ARKR:MFOG:UO6J:LRZS:336R:TNTE:QTIA:64GD:B6HD:CRU6:G2YE:AWLZ
Username: test
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

以下是/ var / log / messages文件

中的日志
Oct 19 10:15:04 ip-10-2-130-44 kernel: [14529077.356962] veth98ee000: renamed from eth0
Oct 19 10:15:04 ip-10-2-130-44 kernel: [14529077.368372] docker0: port 1(veth85fc3ec) entered disabled state
Oct 19 10:15:04 ip-10-2-130-44 kernel: [14529077.400306] docker0: port 1(veth85fc3ec) entered disabled state
Oct 19 10:15:04 ip-10-2-130-44 kernel: [14529077.411398] device veth85fc3ec left promiscuous mode
Oct 19 10:15:04 ip-10-2-130-44 kernel: [14529077.413684] docker0: port 1(veth85fc3ec) entered disabled state
Oct 19 10:15:04 ip-10-2-130-44 kernel: [14529077.491597] XFS (dm-1): Unmounting Filesystem
Oct 19 10:15:07 ip-10-2-130-44 ntpd[3332]: Deleting interface #972 veth85fc3ec, fe80::1cd7:99ff:fe84:1495#123, interface stats: received=0, sent=0, droppedd
=0, active_time=29844 secs
Oct 19 10:15:16 ip-10-2-130-44 kernel: [14529088.927071] XFS (dm-1): Mounting V4 Filesystem
Oct 19 10:15:16 ip-10-2-130-44 kernel: [14529088.935124] XFS (dm-1): Ending clean mount

之前有任何人遇到此错误,如果需要任何其他信息,请告诉我。

2 个答案:

答案 0 :(得分:1)

我已经看到了这个确切的错误,只要这是容器的JSON配置问题就会发生。对于我的情况,在添加主机条目中有一个拼写错误,我添加了一个额外的冒号,例如'a :: b'而不是'a:b'。我花了一个小时来搞清楚。

答案 1 :(得分:0)

我能够重现此错误。如果查询docker主机上不存在的容器,则会给出statusCode = 404错误。

# curl <dockerMachineIP>:2376/v1.21/containers/<validContainerName>/json将为您提供有关容器的所有详细信息。

如果您使用无效的容器ID进行卷曲,则会通过错误 statusCode = 404 进行同样的操作。