I hope you read all previous blog & understood it well, Today lets create a Docker File with LAMP installation, Supervisor (to runservice automatically while starting up container) & Prestashop Framework installation in container as i mentioned in my previous blog.
Come on sysadmin when we have docker container then why should we install Apache2, Mysql, php, Prestashop in our base machine ?
Its time to virtualize our application environment.
To do this, we need to make a Docker file & after execution of that docker file we will build a container in which all of our required application installed.
If you dont want to make Docker File then you can directly download the container from the mentioned command below and get your container ready.
To download the container, you just need to execute:-
docker pull webkul/lamp-with-prestashop
after execution this command, you will get a container named webkul/lamp-with-prestashop and make it in working by execute:-
docker run -i -p 80:80 -p 3306:3306 --name=give_any_name_you_want -d webkul/lamp-with-prestashop
NOTE:- No other services should be running on port 80 and 3306 of your host system. If its running, change the ports in the above docker command & run.
then just go to ypur browser and hit the url:-
then you will be redirect to the installation page of Prestashop framework and then you will be asked some information like database name, database user name, database password, all info is mentioned below:-
DATABASE NAME = prestashop
DATABASE USERNAME = admin
DATABASE PASSWORD = admin
You can also change the password of mysql.
IF you want to access your mysql database graphically then i have added adminer.php too.
To access your database graphically, just hit the url:
Username & Password is same as, i mentioned.
Now your Prestashop Framework is ready.
Now lets have a look How i made Docker file to get Prestashop container ready.
MAINTAINER Prashant Arora <firstname.lastname@example.org>
RUN apt-get -y update
RUN apt-get -y install lamp-server^
RUN mkdir -p /var/lock/apache2 /var/run/apache2
RUN apt-get install -y wget unzip vim nano gedit
RUN apt-get install libapache2-mod-php5 php5-mcrypt php5-gd
RUN php5enmod mcrypt
RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
RUN apt-get install -y openssh-server
RUN mkdir -p /var/run/sshd
RUN apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY mysql.sh /etc/mysql.sh
RUN chmod +x /etc/mysql.sh
COPY prestashop.zip /var/www/html/
RUN cd /var/www/html && unzip prestashop.zip
RUN rm -rf /var/www/html/prestashop.zip
RUN rm /var/www/html/index.html
COPY adminer.php /var/www/html/prestashop/
RUN cd /var/www/html && chown -R www-data: prestashop
For Reference :- https://hub.docker.com/r/webkul/lamp-with-prestashop/
For Source Code :- https://github.com/webkul/LAMP-WITH-PRESTASHOP