10

I have a php docker container where is my symfony project.

Here is my docker-compose.yml

php-fpm:
    build: ./php
    container_name: php-fpm
    links:
        - db
    ports:
        - 9000:9000
        - 8448:8448
        - 8000:8000
    working_dir: /var/www/html/
    volumes:
        - ../app:/var/www/html
    volumes_from:
        - data
    tty: true
    env_file:
        - ./docker.env
    entrypoint: /entrypoint.sh

I want to launch my symfony project with this command:

php bin/console server:run localhost:8000

But it's not working when I want to access the url. I have this error message:

The localhost page isn’t working

localhost didn’t send any data.

How can I fix that?

PS: I'm using docker for mac

And php bin/console -vvv server:run localhost:8000 outputs:

[2016-08-06 14:09:53] php.DEBUG: fsockopen(): unable to connect to localhost:8000 (Connection refused) {"type":2,"file":"/var/www/html/symfony-test/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.php","line":59,"level":28928}

                                                                                                                      [OK] Server running on http://localhost:8000                          

// Quit the server with CONTROL-C.

RUN '/usr/local/bin/php' '-S' 'localhost:8000' '/var/www/html/symfony-test/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php'

2
  • 1
    What php bin/console -vvv server:run localhost:8000 outputs ? Commented Aug 6, 2016 at 10:57
  • 4
    run it on all interfaces: php bin/console server:run 0.0.0.0:8000 Commented Aug 6, 2016 at 19:27

1 Answer 1

17

Following @Alex Blex answer: It works when you run it on all interfaces.

 php bin/console server:run 0.0.0.0:8000
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.