Here's my Dockerfile:
FROM php:5.5-apache
COPY sites-enabled.tgz /root/sites-enabled.tgz
RUN cd /etc/apache2/sites-enabled && \
tar xvf /root/sites-enabled.tgz
I have a number of sites that need to be configured and I figure the easiest way to go about configuring them is to just copy the config files for the sites into the appropriate directories. Unfortunately I'm not able to do so.
I do docker build -t mywebsite .
and then docker run -d mywebsite
. Both of those commands appear to run just fine. The last one gives me a hex encoded string. But then when I do docker ps
I don't see any machines running.
Typically, the files in sites-enabled are symlinks to sites-available. idk if that's the case in every case but if it is then it seems like it might be necessary to copy the sites-available sites over as well. eg.
FROM php:5.5-apache
COPY sites-available.tgz /root/sites-available.tgz
COPY sites-enabled.tgz /root/sites-enabled.tgz
RUN cd /etc/apache2/sites-available && \
tar xvf /root/sites-available.tgz
RUN cd /etc/apache2/sites-enabled && \
tar xvf /root/sites-enabled.tgz
Unfortunately, that doesn't work either. With sites-available.tgz it does but not sites-enabled.tgz.
Any ideas?
the container does what you say, it makes a copy on the file and puts into the container, then it goes to the directory and finally it decompress the file, and that's it. You're not declaring a
CMD
command which will initialize apache, or do anything, so your container will not stay up unless you do thattry putting this at the end of the dockerfile
CMD /usr/sbin/apache2ctl -D FOREGROUND
let me know how it goes