Question

How to fix "WordPress Connection Information" on WP that is running in a docker container ?

Hello,

I have a WP website is running in a docker container. I am using all offical images (WP, MariaDB).

I have a problem that is I can not upgrade WP, plugins, install new plugins, delete unsed plugins,… from WP admin dashboard

In non-docker enviroment, I met the same problem and fix it by the command “chown apache:apache /path/to/wp”. Now on docker I don’t know how to resolve it.

Give me some guide, please.

Thanks in advance.

Best regards,


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

If you’re using Docker-Compose, you’ll want to run bash or sh into your Wordpress service container:

sudo docker-compose exec WORDPRESS_SERVICE_NAME sh

When done correctly you should find yourself within the Wordpress /var/www/html directory inside the container. You want to make sure you’re in the same directory that the wp-config.php file is located.

Open wp-config.php with your text editor of choice and add the following line to the end of the file:

define('FS_METHOD','direct');

Save or write the changes to the file and navigate back to the Wordpress update page, it should now be able to update without needing the FTP connection information.

Thanks to http://www.hongkiat.com/blog/update-wordpress-without-ftp/ for the tip.

After you’ve finished updating you can always go back and comment out the addition if you’re worried you’ll have users on the server who might upload malicious code. You can read up on the security concerns for this here.

works only with apache2 Use this code , wordpress asking for ftp details because wordpress doesn’t have permission to write in your server. use these two commands in terminal.

$sudo a2enmod rewrite $sudo chown -R www-data /var/www

video guide https://www.youtube.com/watch?v=RGGWVUIvhnk

Thank you, it works on normal lamp mod_php over Centos 7 also.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.