how would i install apache2 in a docker container?

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:

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
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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel