bash /bin/sh: apt-get: 未找到
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45142855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
/bin/sh: apt-get: not found
提问by Hüseyin Orkun Elmas
I am trying to change a dockerFile to work with aspell. I have a bash script that i want to wrap in a dock
我正在尝试更改 dockerFile 以使用 aspell。我有一个 bash 脚本,我想将其包装在码头中
Step 4: Wrap the script in a Docker container.
The sample SDK we downloaded earlier contains an example of an action wrapped in a Docker container. In particular, the sample SDK includes a Dockerfile that builds the C program in client/example.c and installs the binary as /blackbox/client/action .
The key line in the sample Dockerfile is:
RUN cd /blackbox/client; gcc -o action example.c
Instead of compiling example.c and installing the binary as an action, we'll change the Dockerfile to install aspell into the Linux environment, and then install our action.sh script as the executable action command.
To do so, we delete the RUN command above, and insert the following commands into the Dockerfile:
RUN apt-get install -y aspell
RUN rm -f /blackbox/client/action
ADD action.sh /blackbox/client/action
i am trying to do this on the dockerfile below
我正在尝试在下面的 dockerfile 上执行此操作
# Dockerfile for example whisk docker action
FROM openwhisk/dockerskeleton
ENV FLASK_PROXY_PORT 8080
### Add source file(s)
ADD example.c /action/example.c
RUN sudo apt-get install -y aspell
RUN rm -f /blackbox/client/action
ADD action.sh /blackbox/client/action
CMD ["/home/huseyin/bin", "-c", "cd actionProxy && python -u actionproxy.py"]
the tutorial is outdated so i can't succeed doing it. Can you help me?
该教程已过时,所以我无法成功。你能帮助我吗?
回答by Serey
The image you're usingis Alpine based, so you can't use apt-get
because it's Ubuntu's package manager.
您使用的映像是基于 Alpine 的,因此您无法使用,apt-get
因为它是 Ubuntu 的包管理器。
To fix this just use:
要解决这个问题,只需使用:
apk update
and apk add
apk update
和 apk add
回答by Venu Gopal Tewari
If you are looking inside dockerfile while creating image, add this line:
如果您在创建图像时查看 dockerfile 内部,请添加以下行:
RUN apk add --update yourPackageName