Richard Bernstein
Richard Bernstein

Reputation: 371

my docker-compose is failing on this line. Why?

I need to copy a php.ini file that I have (with xdebug enabled) to /bitnami/php-fpm/conf/. I am using a bitnami docker container, and I want to use xdebug to debug the php code in my app. Therefore I must enable xdebug in the php.ini file. The /bitnami/php-fpm container on the repository had this comment added to it:

5.5.30-0-r01 (2015-11-10) php.ini is now exposed in the volume mounted at /bitnami/php-fpm/conf/ allowing users to change the defaults as per their requirements.

So I am trying to copy my php.ini file to /bitnami/php-fpm/conf/php.ini in the docker-compose.yml. Here is the php-fpm section of the .yml:

  php-fpm:
    image: bitnami/php-fpm:5.5.26-3
  volumes:
     - ./app:/app
     - php.ini:/bitnami/php-fpm/conf
   networks:
      - net
volumes:
  database_data:
    driver: local
networks:
  net:

Here is the error I get: ERROR: Named volume "php.ini:/bitnami/php-fpm/conf:rw" is used in service "php-fpm" but no declaration was found in the volumes section.

Any idea how to fix this?

Upvotes: 0

Views: 666

Answers (1)

leeman24
leeman24

Reputation: 2899

I will assume that your indentation is correct otherwise you probably wouldn't get that error. Always run your yaml's through a lint tool such as http://www.yamllint.com/.

In terms of your volume mount, the first one you have the correct syntax but the second you don't therefore Docker thinks it is a named volume.

Assuming php.ini is in the root directory next to your docker-compose.yml.

  volumes:
     - ./app:/app
     - ./php.ini:/bitnami/php-fpm/conf

Upvotes: 1

Related Questions