在树莓派上运行Debian中的docker容器。我有以下代码:
pi@raspi:~ $ docker container run --rm -it debian
root@64711f73f7da:/# time curl http://google.com
bash: curl: command not found
然而,如果我在docker容器之外运行curl,它运行得很好:
pi@raspi:~ $ curl -V
curl 7.64.0 (arm-unknown-linux-gnueabihf) libcurl/7.64.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
我还尝试在which curl
中指定curl在docker容器中的路径,它将其位置指定为here:/usr/bin/curl
。结果类似于上述(bash: /usr/bin/curl: No such file or directory
)
如何让curl在Docker Container中运行?
发布于 2021-06-30 03:46:56
在这里找到了答案:Can't run Curl command inside my Docker Container
但要详细说明的是:即使Raspberry Pi上的Debian OS安装了curl,并且我可以从终端访问它,Docker Container中的Debian镜像也需要curl。因此,在Docker Container中,需要同时安装root@d120d03b37db:/# apt-get update
和root@d120d03b37db:/# apt-get install curl
,以便Debian镜像可以引用curl
https://stackoverflow.com/questions/68183701
复制相似问题