Error db connection running Symfony 1.4 propel app under docker

Hello,
I try to run my old Sympony 1.4 proper app under docker and for this I have in my docker-compose.yml :

version: '3.1'

services:


    web:

        container_name: Demo_Ads_web

        build:
            context: ./web
            dockerfile: Dockerfile.yml
        
        environment:
            - APACHE_RUN_USER=www-data
        volumes:
            - ${APP_PATH_HOST}:${APP_PTH_CONTAINER}

        ports:
            - 8090:80
        working_dir: ${APP_PTH_CONTAINER}


    db:
        container_name: Demo_Ads_db
        image: mysql:5.6.46
        restart: always
        environment: 
            MYSQL_ROOT_PASSWORD: 1
        volumes:
            - ${DB_PATH_HOST}:/var/lib/mysql


    phpmyadmin:
        container_name: Demo_Ads_phpmyadmin
        depends_on:
          - db
        image: phpmyadmin/phpmyadmin
        restart: always
        ports:
          - 8091:80
        environment:
          PMA_HOST: db
          MYSQL_ROOT_PASSWORD: 1

I installed mysql / mysqli in my web/Dockerfile.yml file
I am not sure which is valid format for /config/databases.yml, as I need to set db container in it.
I tried it as :


all:
  propel:
    class:          sfPropelDatabase
    param:
      dsn:          mysql://root:db@1/Demo_Ads_Docker

where Demo_Ads_Docker is db name
1 - password
db - database container
root logged user

But looks like that is invalid, as I got error :
[wrapped: connect failed [Native Error: Invalid argument] [User Info: Array]]

Which is valid format? Is it error because of wrong params in databases.yml ?

Thanks!

I don’t know about the error message, but judging by the different indentation it looks like you may have edited with a mix of spaces and tabs. YAML is extremely particular about indentation. I recommend you try linting as a troubleshooting first step just to make sure that isn’t the problem.

Good remark, I checked more time that is not indentations issue…
With invalid indentation I got error like :
Unable to parse file
???

1 Like

The format is protocol://user:password@host/database

So this case it should be mysql://root:1@db/Demo_Ads_Docker

1 Like

Also, you also need to quote port numbers in Docker, so 8091:80 should be "8091:80"
See https://docs.docker.com/compose/compose-file/#ports

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.