0

I tried to installed a LAMP stack with a DockerFile in a directory on my desktop /home/username/Desktop/docker/lamp/:

FROM ubuntu:16.04

VOLUME ["/var/www"]

RUN apt-get update && \
    apt-get dist-upgrade -y && \
    apt-get install -y \
      apache2 \
      php7.0 \
      php7.0-cli \
      libapache2-mod-php7.0 \
      php7.0-gd \
      php7.0-json \
      php7.0-ldap \
      php7.0-mbstring \
      php7.0-mysql \
      php7.0-pgsql \
      php7.0-sqlite3 \
      php7.0-xml \
      php7.0-xsl \
      php7.0-zip \
      php7.0-soap

COPY apache_default /etc/apache2/sites-available/000-default.conf
COPY run /usr/local/bin/run
RUN chmod +x /usr/local/bin/run
RUN a2enmod rewrite

EXPOSE 80
CMD ["/usr/local/bin/run"]

Then on my terminal, I run it:

$ docker build -t docker-lamp .

Step 4 : COPY apache_default /etc/apache2/sites-available/000-default.conf
lstat apache_default: no such file or directory

What I have done wrong? How can I fix this?

Run
  • 54,938
  • 169
  • 450
  • 748

1 Answers1

1

First of all, are you 100% sure the files apache_default and run are in the same directory as the Dockerfile?

Fran García
  • 2,011
  • 16
  • 24
  • `are you 100% sure the file apache_default is in the same directory as the Dockerfile?` how do i find this out? – Run Jan 10 '17 at 11:43
  • just list the contents of the directory where you put the Dockerfile in – Fran García Jan 10 '17 at 12:03
  • you mean doing this on my terminal - `$ ls`? – Run Jan 10 '17 at 12:29
  • 1
    yes, just an ls and outputting the results will help – Fran García Jan 10 '17 at 12:46
  • i didn't put `000-default.conf` in the folder! My mistake. – Run Jan 10 '17 at 12:53
  • I thought it should have been created by Docker automatically when you are building the image! – Run Jan 10 '17 at 12:54
  • 1
    How come that? In your Dockerfile, you are copying the files apache_default and run from the host to the container. You need to do this kind of things when you need to override the "normal" behaviour. I can imagine why you want to override the file 000-default.conf but I don't know why you want to override the run script. – Fran García Jan 10 '17 at 14:15
  • I follow this DockerFile https://github.com/bylexus/docker-apache-php7/blob/master/Dockerfile actually. I'm new to Docker so I am trying to learn from other DockerFiles. – Run Jan 10 '17 at 14:22
  • `I can imagine why you want to override the file 000-default.conf but I don't know why you want to override the run script.` do you mean that I can just leave the run script as it is? but in your answer, you said u would try `COPY run /usr/local/bin/`?? – Run Jan 10 '17 at 14:22
  • as you can see at https://github.com/bylexus/docker-apache-php7, there are 2 files called apache_default and run that you would also need to have in your local environment. – Fran García Jan 10 '17 at 16:38
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/132833/discussion-between-fran-garcia-and-teelou). – Fran García Jan 10 '17 at 17:23