Hi, I have installed docker ce on ubuntu server 16.04.
I’m newbie in Docker and I’m trying to write a docker file.
My intent is to get a “Lamp image” and prepare it for creating a new image ready for launch a new Drupal installation.
I created a new folder with a subfolder called “drupal” that contains the drupal’s installation files.
in my new folder I created this “dockerfile”:
FROM fauria/lamp
WORKDIR /app
ADD . /app
RUN service apache2 start
RUN service mysql start
RUN mv /app/drupal /var/www/html
RUN cd /var/www/html/drupal
RUN cp ./sites/default/default.settings.php ./sites/default/settings.php
EXPOSE 80
but this doesn’t work: I received an error while executing the last “cp” command:
“no such file or directory”.
What’s I’m doing wrong?
I don’t know if I have to use RUN or CMD for my intent: what’s correct approach?
thank you, with COPY instead of ADD the folder has been copied in /app/drupal
but I’m afraid I did not understand how docker works cause the next three instructions (I tried to run the script with only the first three RUN instructions) do not seem to have an effect, although I do not receive any error message.
I executed this command: docker build -t demodrupal .
everything seems to work fine… but I dont understand, if i try to execute this command… docker run -it demodrupal /bin/bash
and then ls /var/www/html
I can’t see drupal folder…
if I execute this command: service apache2 status the response is "apache2 is not running"
maybe I’m confusing … I’d like to understand what I’m wrong
Ok I made progress! I copied “drupal” folder to “/var/www/html/drupal” but I need one more thing:
the folder now has owner “root”, group “root” and mod 755.
I need to change this permissions and I tried with RUN chgrp -R www-data /var/www/html/drupal RUN chmod -R 775 /var/www/html/drupal
but no way! never works!
how can I get the desired result?
thank you very much for help
The problem depends on the image I was using.
Unfortunately it was my very first tests with docker and I had not yet used other images: for example, with the image “tutum/lamp” the instructions to change group and permissions works.
For example for my new working test I used: COPY ./drupal /drupal RUN mv /drupal /var/www/html/drupal && chgrp -R www-data /var/www/html/drupal &&\ chmod -R 775 /var/www/html/drupal
these commands work