Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run wget inside Ubuntu Docker image?

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/ubuntu-14.04/gitlab_7.8.2-omnibus.1-1_amd64.deb 

I get

exec: "wget": executable file not found in $PATH 

I've already installed wget with docker as follows:

run ubuntu:14.04 apt-get install wget 

How can I download a file?

like image 476
Marian Klühspies Avatar asked Mar 05 '15 18:03

Marian Klühspies


People also ask

How do I run a Docker image in Ubuntu?

Run a Docker Container in Ubuntu In order to create and run a Docker container, first you need to run a command into a downloaded CentOS image, so a basic command would be to check the distribution version file inside the container using cat command, as shown.

Does Alpine have wget?

Alpine comes with wget implemented in its Busybox multi-call binary.

Is there a GUI for Docker Ubuntu?

You can now manage your local Docker instance in a nice friendly GUI. Lets see what Portainer can do for you.. You are able to: Deploy applications via App Templates (Click to Deploy)


2 Answers

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 
like image 91
Thomas Orozco Avatar answered Oct 03 '22 07:10

Thomas Orozco


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.

like image 31
Lincoln Avatar answered Oct 03 '22 06:10

Lincoln