Docker Community Forums

Share and learn in the Docker community.

Dockerfile won't run terminal commands!


(Giumbai) #1

Using the instruction from https://docs.docker.com/articles/dockerfile_best-practices/ , anything having to to do with in stalling or upgrading/updating software doesn’t works.

My docker file:

#Base image ubuntu 14.04

FROM ubuntu:14.04
RUN apt-get update && apt-get -y upgrade  && apt-get -y dist-upgrade # this could be anything that is about package manager.
ENV PATH /usr/bin:/usr/sbin:/usr/local/bin:/root/.composer/vendor/bin
COPY README.md /
COPY ./entrypoint.sh /
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 80
CMD ["service apache2 start"]

I tried even on another machine thinking it has something to do with my Laptop, same result. The example is just an example i tried multiple configurations, i tried docker files from github and so on, everytime there is something regarding package manger it fails. Is there something that I’m missing or is just broken

Docker version 1.8.2, build 0a8c2e3

docker version

  Client:
   Version:      1.8.2
   API version:  1.20
   Go version:   go1.4.2
   Git commit:   0a8c2e3
   Built:        Thu Sep 10 19:20:17 UTC 2015
   OS/Arch:      linux/amd64

  Server:
   Version:      1.8.2
   API version:  1.20
   Go version:   go1.4.2
   Git commit:   0a8c2e3
   Built:        Thu Sep 10 19:20:17 UTC 2015
   OS/Arch:      linux/amd64

docker info

 Containers: 15
 Images: 15
 Storage Driver: btrfs
 Build Version: Btrfs v4.1
 Library Version: 101
 Execution Driver: native-0.2
 Logging Driver: json-file
 Kernel Version: 4.1.10-200.fc22.x86_64
 Operating System: Fedora 22 (Twenty Two)
 CPUs: 4
 Total Memory: 7.69 GiB
 Name: physicalit
 ID: WART:PRLN:CFEN:H6SI:7V26:FAWC:CW76:FDMV:JU3G:5RHB:ZGKG:3QZB
 Username: giumbai
 Registry: https://index.docker.io/v1/

uname -r

Linux hostname 4.1.10-200.fc22.x86_64 #1 SMP Mon Oct 5 14:22:49 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

(Ranjandas) #2

Hi,

Isn’t apt-get update working for you? In your above example apt-get upgrade and apt-get dist-upgrade wont work as it will wait with a prompt for you to accept whether or not to install the packages.

So when dealing with package installation commands try to use -y option so that package manager starts the installation without prompting.

Example

RUN apt-get update && apt-get -y upgrade

Regards