Docker Community Forums

Share and learn in the Docker community.

Not able to install anything with apt-get on a docker container


(Guirec Corbel) #1

I just created a new container with this command docker pull ubuntu. It created a new container as expected. When I run docker run -t -i ubuntu apt-get install wget it install wget. When I run it a second time, it install wget again. When I start bash, wget is not found.

Here are traces :

➜  docker pull ubuntu
latest: Pulling from ubuntu
e9e06b06e14c: Already exists
a82efea989f9: Already exists
37bea4ee0c81: Already exists
07f8e8c5e660: Already exists
Digest: sha256:8126991394342c2775a9ba4a843869112da8156037451fc424454db43c25d8b0
Status: Image is up to date for ubuntu:latest

➜  docker run -t -i ubuntu apt-get install wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  ca-certificates libidn11 openssl
The following NEW packages will be installed:
  ca-certificates libidn11 openssl wget
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1026 kB of archives.
After this operation, 2397 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libidn11 amd64 1.28-1ubuntu2 [93.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main openssl amd64 1.0.1f-1ubuntu2 [489 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main ca-certificates all 20130906ubuntu2 [175 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main wget amd64 1.15-1ubuntu1 [270 kB]
Fetched 1026 kB in 4s (233 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libidn11:amd64.
(Reading database ... 11528 files and directories currently installed.)
Preparing to unpack .../libidn11_1.28-1ubuntu2_amd64.deb ...
Unpacking libidn11:amd64 (1.28-1ubuntu2) ...
Selecting previously unselected package openssl.
Preparing to unpack .../openssl_1.0.1f-1ubuntu2_amd64.deb ...
Unpacking openssl (1.0.1f-1ubuntu2) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../ca-certificates_20130906ubuntu2_all.deb ...
Unpacking ca-certificates (20130906ubuntu2) ...
Selecting previously unselected package wget.
Preparing to unpack .../wget_1.15-1ubuntu1_amd64.deb ...
Unpacking wget (1.15-1ubuntu1) ...
Setting up libidn11:amd64 (1.28-1ubuntu2) ...
Setting up openssl (1.0.1f-1ubuntu2) ...
Setting up ca-certificates (20130906ubuntu2) ...
Setting up wget (1.15-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ca-certificates (20130906ubuntu2) ...
Updating certificates in /etc/ssl/certs... 164 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.

➜  docker run -t -i ubuntu apt-get install wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  ca-certificates libidn11 openssl
The following NEW packages will be installed:
  ca-certificates libidn11 openssl wget
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1026 kB of archives.
After this operation, 2397 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libidn11 amd64 1.28-1ubuntu2 [93.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main openssl amd64 1.0.1f-1ubuntu2 [489 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main ca-certificates all 20130906ubuntu2 [175 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main wget amd64 1.15-1ubuntu1 [270 kB]
Fetched 1026 kB in 5s (175 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libidn11:amd64.
(Reading database ... 11528 files and directories currently installed.)
Preparing to unpack .../libidn11_1.28-1ubuntu2_amd64.deb ...
Unpacking libidn11:amd64 (1.28-1ubuntu2) ...
Selecting previously unselected package openssl.
Preparing to unpack .../openssl_1.0.1f-1ubuntu2_amd64.deb ...
Unpacking openssl (1.0.1f-1ubuntu2) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../ca-certificates_20130906ubuntu2_all.deb ...
Unpacking ca-certificates (20130906ubuntu2) ...
Selecting previously unselected package wget.
Preparing to unpack .../wget_1.15-1ubuntu1_amd64.deb ...
Unpacking wget (1.15-1ubuntu1) ...
Setting up libidn11:amd64 (1.28-1ubuntu2) ...
Setting up openssl (1.0.1f-1ubuntu2) ...
Setting up ca-certificates (20130906ubuntu2) ...
Setting up wget (1.15-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ca-certificates (20130906ubuntu2) ...
Updating certificates in /etc/ssl/certs... 164 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done. 

➜  docker run -t -i ubuntu /bin/bash
root@68b55de7a9d7:/# wget
bash: wget: command not found

Here is information about my os :

uname -r
3.13.0-24-generic
uname -a
Linux oscar 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I have the same behavior with a docker fill. It works when I install thinks in the bash but when I quit and rerun bash the command is not found again.

Did I miss something ?


(Bchanan) #2

i think you need to:

  • run instance as detached by adding -d
  • docker run exec apt-get install -y wget
  • docker attach
    will allow you enter into container /bin/bash
    there you will be able to run wget
  • if you want to update the image use docker commit