Hi,
This is my dockefile content
The instruction EXPOSE 3000 doesn’t allow apache server to run on port 3000.
Someone can help me to find the way ?
Hi,
This is my dockefile content
The instruction EXPOSE 3000 doesn’t allow apache server to run on port 3000.
Someone can help me to find the way ?
Remember here that the container is running the apache binary (indirectly via apachectl). Exposing a port in the container’s network won’t help you unless apache is actually using port 3000. To do that, you need to alter apache’s configuration, doing something like this:
Dockerfile:
# don't use a Ubuntu container when you just want apache!!
FROM httpd:2.4
# Change apache's configuration.
# @see https://hub.docker.com/_/httpd
RUN sed -i 's/^Listen 80/Listen 3000/' /usr/local/apache2/conf/httpd.conf
EXPOSE 3000
So, we build it and test it out:
docker build -t apache3000 .
docker run --name apache -p 3000:3000 -d apache3000
curl localhost:3000
and we see:
$ curl localhost:3000
<html><body><h1>It works!</h1></body></html>