bitnami/bitnami-docker-php-fpm

Load local php.ini when running php command or composer

FrodeMMeling opened this issue · 3 comments

Description
It does not seem that running container with php command loads local php.ini

Steps to reproduce the issue:

  1. To get a local copy of config by starting container once:
    docker run --rm -v `pwd`/php-config:/bitnami bitnami/php-fpm:latest
  2. verify that php-config/php/conf/php.ini has a custom setting like date.timezone = UTC
  3. Run docker run --rm -v `pwd`/php-config:/bitnami bitnami/php-fpm:latest php --info |grep timezone

Describe the results you received:

Welcome to the Bitnami php-fpm container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-php-fpm
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-php-fpm/issues
Send us your feedback at containers@bitnami.com

Default timezone => UTC
date.timezone => no value => no value

Describe the results you expected:

Welcome to the Bitnami php-fpm container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-php-fpm
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-php-fpm/issues
Send us your feedback at containers@bitnami.com

Default timezone => UTC
date.timezone => UTC

CMD is not loaded so ini file is not loaded?

Version

Use latest version

Client:
 Version:      17.09.0-ce-rc3
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   2357fb2
 Built:        Thu Sep 21 02:31:18 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.09.0-ce-rc3
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   2357fb2
 Built:        Thu Sep 21 02:36:52 2017
 OS/Arch:      linux/amd64
 Experimental: true
  • Output of docker info:
Containers: 27
 Running: 24
 Paused: 0
 Stopped: 3
Images: 74
Server Version: 17.09.0-ce-rc3
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: moby
ID: 3MK5:LYMM:FKBW:N66I:WC7Z:AJST:VUNK:B4JT:K3XX:EE5K:VLAW:6LQO
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 212
 Goroutines: 176
 System Time: 2017-09-25T07:54:35.355794337Z
 EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Running on mac.

Hi @FrodeMMeling

I am sorry for the delay.

This issue appears because when you execute some commands from the docker cli, docker launches the container and executes the app-entrypoint.sh script and, as you can see in the code, it doesn't initialises the nami module, which is the one that loads the configuration of PHP.

So, for now, the only workaround I can give you is launching the container in daemon mode with:

docker run -d -v pwd/php-config:/bitnami bitnami/php-fpm:latest

And executing all the necessary commands with

docker exec CONTAINER_ID php --info | grep timezone

docker exec CONTAINER_ID php --info | grep timezone
Default timezone => UTC
date.timezone => UTC => UTC

Note: Do not forget to change the CONTAINER_ID placeholder for the id of the container you have just launched.

I have also created an internal ticket to check this and evaluate changing the init scripts of our container to have the functionality you request by default.

I hope this information is useful for you.

Thank you and best regards,
David Barranco.

stale commented

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

stale commented

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.