I am a beginner in Docker and am trying to create an image with the following specifications:
The ultimate goal is to create an image that will be shared among all the company's developers.
This is the Dockerfile I'm using:
FROM ubuntu:16.04
#1
RUN apt-get update
#2
RUN apt-get install -y apache2
#3
RUN apt-get install -y php5
#4
RUN apt-get install -y redis-server
#5
RUN apt-get install -y php5-redis
COPY /home/username/vhosts/mySite /var/www/html
EXPOSE 80
Next I'm encountering some errors:
Operation # 3, php5 is not part of the ubuntu 16.04 package list. This post it turns out that it needs to be updated as follows:
#6
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.6
Operation # 6,
I get an error saying that sudo
is not recognized as a command (even if I try to run in iterative mode on the -ti terminal). Doing a search I find that sudo
is not enabled in the Ubuntu16.04 image.
If I try to run without sudo via terminal ( docker run -ti ...
), I get a message saying add-apt-repository
not found
.
Doinga another search for this error I find that add-apt-repository
is also not available for Ubuntu images 14.04 in docker. And apparently tbm is not available for 16.04. The proposed solution is to run:
#7
apt-get install -y software-properties-common python-software-properties
Running this operation # 7 I get the following error:
Doinganothersearch,Ifindthis post that suggests modifying apt.conf
located in /etc/apt/apt.conf
.
And this is the contents of the apt directory from within the ubuntu 16.04 image
.
Thatis,itdoesnothaveapt.conf
.Doingasearchonsomeapt.conf posts needs to be created.
My conclusion is that I must be doing something very wrong because the goal is to just install php5.6 in Ubuntu16.04.
In conclusion, would anyone know how to say some tried-and-tested way to create an image with the features listed above without going through the previous steps?
UPDATE: It looks like other images have the same problem when they try to install version 5.6 of php .