/bin/sh: apt-get: not found

236,965

Solution 1

The image you're using is Alpine based, so you can't use apt-get because it's Ubuntu's package manager.

To fix this just use:

apk update and apk add

Solution 2

If you are looking inside dockerfile while creating image, add this line:

RUN apk add --update yourPackageName
Share:
236,965

Related videos on Youtube

Hüseyin Orkun Elmas
Author by

Hüseyin Orkun Elmas

Updated on July 22, 2022

Comments

  • Hüseyin Orkun Elmas
    Hüseyin Orkun Elmas almost 2 years

    I am trying to change a dockerFile to work with aspell. I have a bash script that i want to wrap in a dock

    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 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?

    • Raman Sailopal
      Raman Sailopal almost 7 years
      The docker container isn't Debian based? If it isn't Debian based, apt package management won't work.
    • MichaelChirico
      MichaelChirico almost 4 years
      I was in a very silly position basically unrelated to the current question, but maybe can save another Googler who lands here -- I had run docker run ubuntu:latest when I meant to run docker run -it ubuntu:latest. I thought I was running apt-get inside the container, but it was actually in Mac terminal. whoops.
  • Steven
    Steven almost 6 years
    Does this undermine the reasons for using Alpine to begin with or does it still keep the Alpine image considerably light weight?
  • Udhaya
    Udhaya over 4 years
    how to change the below command? hub.docker.com/r/buildkite/puppeteer/dockerfile
  • Rashad Nasirli
    Rashad Nasirli about 2 years
    it is how one answer can save your hours)) thank you