G
G
gigisarri982021-11-24 22:07:23
Docker
gigisarri98, 2021-11-24 22:07:23

How to configure Apache inside Docker?

I'm learning docker, let's say I want to experiment and just execute a script in docker. I have this Dockerfile:

FROM php:7.3-apache

WORKDIR /dockertest

COPY . .

RUN echo "$PWD" > testfile

EXPOSE 8080

I build the image and run the container with forwarding port 8080 to 8080. And Apache starts up, but gives an error 403. Can you please tell me how to configure Apache configs? Is there a way to download them ahead of time? I have read about volumes, but have not figured out if they are suitable for this situation (if they are, then in what way?).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-11-24
@gigisarri98

Fit. When you start the container, mount the Apache config directory.
Example Start a container with a volume
PS
EXPOSE 8080 - does not forward a port to the system, it is an informational directive that tells the user which port the service in the container is listening on. You may not use it at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question