apache - docker: Says connection refused when attempting to connect to a published port -
i'm newbie @ docker. i'm creating hello, world example. i'm trying bring apache in docker , view default website host machine.
dockerfile
from centos:latest run yum install epel-release -y run yum install wget -y run yum install httpd -y expose 80 entrypoint ["/usr/sbin/httpd", "-d", "foreground"]
and build it: > docker build .
and tag it:
docker tag 17283f566320 my:apache
and run it:
> docker run -p 80:9191 my:apache ah00558: httpd: not reliably determine server's qualified domain name, using 172.17.0.2. set 'servername' directive globally suppress message
it runs....
in terminal window, attempt issue curl
command view default web site.
> curl -xget http://0.0.0.0:9191 curl: (7) failed connect 0.0.0.0 port 9191: connection refused > curl -xget http://localhost:9191 curl: (7) failed connect localhost port 9191: connection refused > curl -xget http://127.0.0.1:9191 curl: (7) failed connect 127.0.0.1 port 9191: connection refused
or try localhost
just make sure got port correct, run this:
> docker ps -l container id image command created status ports names 5aed4063b1f6 my:apachep "/usr/sbin/httpd -d f" 43 seconds ago 42 seconds 80/tcp, 0.0.0.0:80->9191/tcp angry_hodgkin
despite created containers in local machine. these running on different machine (a virtual machine)
first, check ip of docker machine (the virtual machine)
$docker-machine ls name active driver state url swarm default * virtualbox running tcp://192.168.99.100
then run curl
command view default web site on apache web server inside container
curl http://192.168.99.100:9191
Comments
Post a Comment