Amazon web services Boto3 ConnectionClosedError在Docker容器内运行时-错误:在从端点URL收到有效响应之前,连接已关闭

Amazon web services Boto3 ConnectionClosedError在Docker容器内运行时-错误:在从端点URL收到有效响应之前,连接已关闭,amazon-web-services,docker,amazon-s3,containers,raspberry-pi4,Amazon Web Services,Docker,Amazon S3,Containers,Raspberry Pi4,我已经构建了一个python应用程序,当直接部署到操作系统(RaspOS)上时,它可以平稳运行。我决定对应用程序进行dockerize,并将其部署到大约20个端点,没有问题。但是现在,在一个端点中,当应用程序将一个文件上传到S3时,通常第一次上传应该发生,但从第二个文件开始,我会收到这个错误消息。 “错误:在从终结点URL收到有效响应之前,连接已关闭:…” 我已经检查了容器,它的互联网链接似乎还可以,它甚至在ping应该上传数据的端点 我有第二个应用程序,它将视频流传输到KVS,但它没有从容器内

我已经构建了一个python应用程序,当直接部署到操作系统(RaspOS)上时,它可以平稳运行。我决定对应用程序进行dockerize,并将其部署到大约20个端点,没有问题。但是现在,在一个端点中,当应用程序将一个文件上传到S3时,通常第一次上传应该发生,但从第二个文件开始,我会收到这个错误消息。 “错误:在从终结点URL收到有效响应之前,连接已关闭:…” 我已经检查了容器,它的互联网链接似乎还可以,它甚至在ping应该上传数据的端点

我有第二个应用程序,它将视频流传输到KVS,但它没有从容器内部连接

检查Docker网络配置似乎也可以

我应该从这里看什么?这件事耽搁了将近两天,我甚至不知道该用谷歌搜索什么了

我猜这似乎是Docker守护进程或操作系统上的一些配置

我做了一些测试,从内部和外部的容器进行比较,它带来了任何线索

内部容器

root@mycontainer# busybox ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=118 time=10.943 ms
64 bytes from 8.8.8.8: seq=1 ttl=118 time=8.586 ms
64 bytes from 8.8.8.8: seq=2 ttl=118 time=8.108 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 8.108/9.212/10.943 ms

root@mycontainer# wget google.com
--2020-10-01 13:04:41--  http://google.com/
Resolving google.com (google.com)... 172.217.30.46, 2800:3f0:4001:809::200e
Connecting to google.com (google.com)|172.217.30.46|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2020-10-01 13:04:41--  http://www.google.com/
Resolving www.google.com (www.google.com)... 172.217.162.164, 2800:3f0:4001:810::2004
Connecting to www.google.com (www.google.com)|172.217.162.164|:80... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2020-10-01 13:04:43--  (try: 2)  http://www.google.com/
Connecting to www.google.com (www.google.com)|172.217.162.164|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html'

index.html                                      [ <=>                                                                                       ]  12.27K  --.-KB/s    in 0s      

2020-10-01 13:04:43 (45.9 MB/s) - 'index.html' saved [12567]
pi@raspberrypi:~/ $ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=7.55 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=119 time=8.09 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=119 time=7.78 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 5ms
rtt min/avg/max/mdev = 7.549/7.807/8.090/0.221 ms

pi@raspberrypi:~/ $ wget google.com
--2020-10-01 13:05:51--  http://google.com/
Resolving google.com (google.com)... 172.217.30.46, 2800:3f0:4001:809::200e
Connecting to google.com (google.com)|172.217.30.46|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2020-10-01 13:05:51--  http://www.google.com/
Resolving www.google.com (www.google.com)... 172.217.28.4, 2800:3f0:4001:810::2004
Connecting to www.google.com (www.google.com)|172.217.28.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

index.html                                                      [ <=>                                                                                                                                     ]  12.27K  --.-KB/s    in 0s

2020-10-01 13:05:52 (60.0 MB/s) - ‘index.html’ saved [12566]
root@mycontainer#busybox ping 8.8.8.8
PING 8.8.8.8(8.8.8.8):56个数据字节
8.8.8.8中的64字节:seq=0 ttl=118时间=10.943毫秒
8.8.8.8中的64字节:seq=1 ttl=118时间=8.586毫秒
8.8.8.8中的64字节:seq=2 ttl=118时间=8.108毫秒
^C
---8.8.8.8平统计---
传输3个数据包,接收3个数据包,0%数据包丢失
往返最小/平均/最大=8.108/9.212/10.943 ms
root@mycontainer#wget google.com
--2020-10-01 13:04:41--  http://google.com/
正在解析google.com(google.com)。。。172.217.30.462800:3f0:4001:809::200e
连接到google.com(google.com)| 172.217.30.46 |:80。。。有联系的。
HTTP请求已发送,正在等待响应。。。301永久搬迁
地点:http://www.google.com/ [以下]
--2020-10-01 13:04:41--  http://www.google.com/
解析www.google.com(www.google.com)。。。172.217.162.1642800:3f0:4001:810::2004
连接到www.google.com(www.google.com)| 172.217.162.164 |:80。。。有联系的。
HTTP请求已发送,正在等待响应。。。标头中的读取错误(对等方重置连接)。
重试。
--2020-10-01 13:04:43——(尝试:2)http://www.google.com/
连接到www.google.com(www.google.com)| 172.217.162.164 |:80。。。有联系的。
HTTP请求已发送,正在等待响应。。。200行
长度:未指定[text/html]
保存到:“index.html”
index.html[]12.27K---KB/s,0秒
2020-10-01 13:04:43(45.9 MB/s)-“index.html”已保存[12567]
外部容器

root@mycontainer# busybox ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=118 time=10.943 ms
64 bytes from 8.8.8.8: seq=1 ttl=118 time=8.586 ms
64 bytes from 8.8.8.8: seq=2 ttl=118 time=8.108 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 8.108/9.212/10.943 ms

root@mycontainer# wget google.com
--2020-10-01 13:04:41--  http://google.com/
Resolving google.com (google.com)... 172.217.30.46, 2800:3f0:4001:809::200e
Connecting to google.com (google.com)|172.217.30.46|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2020-10-01 13:04:41--  http://www.google.com/
Resolving www.google.com (www.google.com)... 172.217.162.164, 2800:3f0:4001:810::2004
Connecting to www.google.com (www.google.com)|172.217.162.164|:80... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2020-10-01 13:04:43--  (try: 2)  http://www.google.com/
Connecting to www.google.com (www.google.com)|172.217.162.164|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html'

index.html                                      [ <=>                                                                                       ]  12.27K  --.-KB/s    in 0s      

2020-10-01 13:04:43 (45.9 MB/s) - 'index.html' saved [12567]
pi@raspberrypi:~/ $ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=7.55 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=119 time=8.09 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=119 time=7.78 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 5ms
rtt min/avg/max/mdev = 7.549/7.807/8.090/0.221 ms

pi@raspberrypi:~/ $ wget google.com
--2020-10-01 13:05:51--  http://google.com/
Resolving google.com (google.com)... 172.217.30.46, 2800:3f0:4001:809::200e
Connecting to google.com (google.com)|172.217.30.46|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2020-10-01 13:05:51--  http://www.google.com/
Resolving www.google.com (www.google.com)... 172.217.28.4, 2800:3f0:4001:810::2004
Connecting to www.google.com (www.google.com)|172.217.28.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

index.html                                                      [ <=>                                                                                                                                     ]  12.27K  --.-KB/s    in 0s

2020-10-01 13:05:52 (60.0 MB/s) - ‘index.html’ saved [12566]
pi@raspberrypi:~/$ping 8.8.8.8
PING 8.8.8.8(8.8.8.8)56(84)字节的数据。
8.8.8.8中的64字节:icmp_seq=1 ttl=119时间=7.55毫秒
8.8.8.8中的64字节:icmp_seq=2 ttl=119时间=8.09毫秒
8.8.8.8中的64字节:icmp_seq=3 ttl=119时间=7.78毫秒
^C
---8.8.8.8平统计---
传输3个数据包,接收3个,0%数据包丢失,时间5ms
rtt最小值/平均值/最大值/mdev=7.549/7.807/8.090/0.221 ms
pi@raspberrypi:~/$wget google.com
--2020-10-01 13:05:51--  http://google.com/
正在解析google.com(google.com)。。。172.217.30.462800:3f0:4001:809::200e
连接到google.com(google.com)| 172.217.30.46 |:80。。。有联系的。
HTTP请求已发送,正在等待响应。。。301永久搬迁
地点:http://www.google.com/ [以下]
--2020-10-01 13:05:51--  http://www.google.com/
解析www.google.com(www.google.com)。。。172.217.28.42080:3f0:4001:810::2004
连接到www.google.com(www.google.com)| 172.217.28.4 |:80。。。有联系的。
HTTP请求已发送,正在等待响应。。。200行
长度:未指定[text/html]
保存到:“index.html”
index.html[]12.27K---KB/s,0秒
2020-10-01 13:05:52(60.0 MB/s)-“index.html”已保存[12566]