/ bin / sh:apt-get:找不到


117

我正在尝试更改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, well 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

我正在尝试在下面的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"]

本教程已经过时,所以我无法成功完成。你能帮助我吗?


5
docker容器不是基于Debian的吗?如果不是基于Debian的话,apt软件包管理将无法正常工作。
拉曼·塞洛帕尔

我当时处于非常愚蠢的位置,基本上与当前问题无关,但也许可以挽救另一位登陆此地的Googler -我本来docker run ubuntu:latest打算跑步时就跑了docker run -it ubuntu:latest。我以为我apt-get在容器内运行,但实际上是在Mac终端中。哎呀
MichaelChirico

Answers:



22

如果在创建映像时正在dockerfile内查看,请添加以下行:

RUN apk add --update yourPackageName
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.