How to run wget inside Ubuntu Docker image?

前端 未结 3 1989
情话喂你
情话喂你 2021-01-30 06:34

I\'m trying to download a Debian package inside a Ubuntu container as follows:

sudo docker run ubuntu:14.04 wget https://downloads-packages.s3.amazonaws.com/ubun         


        
相关标签:
3条回答
  • 2021-01-30 06:39

    If you're running ubuntu container directly without a local Dockerfile you can ssh into the container and enable root control by entering su then apt-get install -y wget

    0 讨论(0)
  • 2021-01-30 06:40

    I had this problem recently where apt install wget does not find anything. As it turns out apt update was never run.

    apt update
    apt install wget
    

    After discussing this with a coworker we mused that apt update is likely not run in order to save both time and space in the docker image.

    0 讨论(0)
  • 2021-01-30 06:53

    You need to install it first. Create a new Dockerfile, and install wget in it:

    FROM ubuntu:14.04
    RUN  apt-get update \
      && apt-get install -y wget \
      && rm -rf /var/lib/apt/lists/*
    

    Then, build that image:

    docker build -t my-ubuntu .
    

    Finally, run it:

    docker run my-ubuntu wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.8.2-omnibus.1-1_amd64.deb
    
    0 讨论(0)
提交回复
热议问题