Trying to enable/disable xdebug on my php-fpm docker container.
If I start an interactive shell using docker exec my_container bash
then run:
sed -i 's/^#zend_extension/zend_extension/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
or
sed -i 's/^zend_extension/#zend_extension/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
The file /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
has the #
added and removed as expected. However my script to do the same:
docker exec my_container bash -c "sed -i 's/^#zend_extension/zend_extension/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
Then nothing happens. I'm not using shell variables to there's no variable expansion issues as far as I'm aware.
Up til now my script has been:
docker exec -it my_container bash -c "cp /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /tmp/xdebug.ini; sed -i 's/^#zend_extension/zend_extension/' /tmp/xdebug.ini; cp /tmp/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
But I would like to get to the bottom of it. It's driving me nuts.
Note: Anywhere I say docker exec my_container
the my_container
is actually a couple of commands in backticks to get the correct container, I just say my_container
to make it more clear.
Any ideas?