Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
Access a docker containers own localhost inside that container -- php apache

I am trying to access the http://localhost/ or http://127.0.0.1 from inside the docker container itself. I can ping localhost when I am inside the running container:

$ sudo docker exec -i -t 045ff7f4755b /bin/bash
$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.108 ms

But, I get an error when I try

$ curl 127.0.0.1/api.php
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

Here is my dockerfile:

FROM php:7.1.0-apache
RUN pecl install xdebug-2.5.0 \
    && docker-php-ext-enable xdebug

RUN mkdir /opt/framework
COPY . /opt/framework
COPY . /var/www/html/

WORKDIR /opt/framework
ENTRYPOINT ["docker-php-entrypoint"]

The endgame here, is to be able to run codeception (an acceptance tester) inside that container and for everything to be contained inside that container. I am also open to the idea that I may be approaching this entirely wrong. I am new to docker, and am not sure the best way to get my desired result.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!