how would i install apache2 in a docker container?

July 20, 2018 232 views
Docker Apache PHP Ubuntu 16.04

is it possible to install apache2,php on a docker container with my discourse site? because i want to be able to run apache2 sites with my discourse site.

i've tried these:
https://docs.docker.com/samples/library/httpd/
https://writing.pupius.co.uk/apache-and-php-on-docker-44faef716150
https://stackoverflow.com/questions/27768194/how-to-use-docker-container-as-apache-server

but they always came back with errors. any help is appreciated!

Some of the errors:


root@vps1:~# COPY ./public-html/ /usr/local/apache2/htdocs/
COPY: command not found
root@vps1:~# docker run -dit --name apache-web -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4
Unable to find image 'httpd:2.4' locally
2.4: Pulling from library/httpd
d660b1f15b9b: Pull complete
aa1c79a2fa37: Pull complete
f5f6514c0aff: Pull complete
676d3dd26040: Pull complete
4fdddf845a1b: Pull complete
28ecdadc5f88: Pull complete
5d882098e42b: Pull complete
Digest: sha256:2edbf09d0dbdf2a3e21e4cb52f3385ad916c01dc2528868bc3499111cc54e937
Status: Downloaded newer image for httpd:2.4
fd54e22eb0a3459de92580436faa24f88c6a47b97ce65d726d9fb87f3970bc54
root@vps1:~# docker run -dit --name apache-web -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4
docker: Error response from daemon: Conflict. The container name "/apache-web" is already in use by container "fd54e22eb0a3459de92580436faa24f88c6a47b97ce65d726d9fb87f3970bc54". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
root@vps1:~# cd /usr/local/apache2/conf
-bash: cd: /usr/local/apache2/conf: No such file or directory
root@vps1:~# nano /usr/local/apache2/conf
root@vps1:~# ./Dockerfile
-bash: ./Dockerfile: No such file or directory
root@vps1:~# ./apache-config.conf
-bash: ./apache-config.conf: No such file or directory
root@vps1:~# ./www/index.php
-bash: ./www/index.php: No such file or directory
root@vps1:~# FROM httpd:2.4
FROM: command not found
root@vps1:~# COPY ./public-html/ /usr/local/apache2/htdocs/
COPY: command not found

1 Answer
Have another answer? Share your knowledge.