/bin/sh:1:sudo:在运行dockerfile时未找到
这是我的Dockerfile的内容/bin/sh:1:sudo:在运行dockerfile时未找到,docker,dockerfile,Docker,Dockerfile,这是我的Dockerfile的内容 FROM ubuntu RUN sudo apt-get update RUN sudo apt-get install -y wget CMD wget -O- -q http://ifconfig.me/ip 当我运行Dockerfile来构建docker映像时,我得到以下错误: /bin/sh:1:sudo:未找到 您能帮我解决上述错误吗?默认情况下,docker容器以root用户身份运行user 从Dockerfile中删除sudo,然后再次运
FROM ubuntu
RUN sudo apt-get update
RUN sudo apt-get install -y wget
CMD wget -O- -q http://ifconfig.me/ip
当我运行Dockerfile来构建docker映像时,我得到以下错误:
/bin/sh:1:sudo:未找到
您能帮我解决上述错误吗?默认情况下,docker容器以root用户身份运行user
从Dockerfile中删除sudo,然后再次运行
在这种情况下,您不需要sudo。将Dockerfile更改如下-
FROM ubuntu
RUN apt-get update -y && \
apt-get install -y wget
CMD wget -O- -q http://ifconfig.me/ip
PS-尽可能多地合并运行语句。docker文件中的命令在
docker build期间已作为根运行。由于这个原因,您不需要使用sudo
可能重复的$docker run-it ubuntu-in-container#suremove sudo from dockerfile从dockerfile中删除sudo后,我收到一个新的错误E:找不到包wget@yeputons我不会说它是的副本,因为它没有提到错误消息,这里这个问题的答案已经是问题的第一句话了。另外,用#提示表示root用户这应该有助于您获得Docker Daemon的相关权限