Where is `config.php` in Windows Docker setup?

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version 17.0.2:
Operating system and version Widows 10:
Apache or nginx version ?:
PHP version ?:

The issue you are facing:
Unable to find (and hence) modify the config.php in a Windows 10 Docker installation of Nextcloud.

Is this the first time you’ve seen this error? Y:

Steps to replicate it:

  1. Open CMD (in admin mode) and enter:
  2. docker run -d -p 8080:80 nextcloud
  3. docker run -t -d -p 9980:9980 -e "extra_params=--o:ssl.enable=false" collabora/code
  4. Open browser, and enter:
  5. http://<my local ipv4-adress>:8080/settings

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

This relates back the the question, where is the path to nextcloud inside docker in Windows?

The output of your Apache/nginx/system log in /var/log/____:

This relates back the the question, where is the /var/.. to nextcloud inside docker in Windows?

According to: https://stackoverflow.com/questions/19234831/where-are-docker-images-stored-on-the-host-machine and https://blog.jongallant.com/2017/11/ssh-into-docker-vm-windows/

You can’t directly access/browse the files within the docker images directly, but you can still access them with:
0. open cmd

  1. enter:
docker run --privileged -it -v /var/run/docker.sock:/var/run/docker.sock jongallant/ubuntu-docker-client 
docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh
chroot /host
  1. Then you’re into the linux file system that is used by docker, and I presume you can then locate your nextcloud config.php with (assuming it is in /var/lib/):
cd ..
cd ..
cd var/lib/
find . -name "config.php"

That results in the list of all config.php files within directory /var/lib/. Then you should find the nextcloud one, I think you should use the long code you get when you enter:

docker run -d -p 8080:80 nextcloud

To identify the correct instance of the config.php files, but I have not tested it yet.

You can display the contents of the config.php file with cat config.php after browsing into the correct directory. However I do not yet know how to edit the file as nano and vim are not available through the cmd bash. Furthermore, the config.php file consists of the php code that renders the interface through which one can set the configuration, instead of a storage of the actual configurations which I intended to modify. Therefore I would have to look further to identify the correct file to modify to satisfy the xy-problem.

Since Nano is not available in the ubuntu version downloaded in docker by the commands specified at 1, one can use the cat command to modify files.

  1. Browse into the directory that contains the config.php file.
  2. Display the content of the config.php file by typing:
cat config.php

Copy that content.
6. Paste and edit the copied content in a windows editor, e.g. notepad++
5. Re-open cmd Delete the config.php with:

rm config.php
  1. Re-create the file and enter its content by:
cat > config.php
  1. RMB in the command window to paste the content
  2. Press ctrl+c to end entering lines to the file.
  3. That should be it, verify again with cat config.php
1 Like

nope. you modify the file inside the container. and hence will be astonished when you update your image and start a new container.

important to understand the difference between image and container!

normally you create a volume for all data you want to have persistent between updates of your image. that’s why you use -v nextcloud:/var/www/html

using just nextcloud (not a path in your hosts file system) you’ll find your nextcloud installation somewhere below /var/lib/docker (if i remember well) docker inspect nextcloud will tell you. or docker volumes ls. if you want to have c:\user\a-t-0\documents accessible inside your container it’s probably -v c:\user\a-t-0\documents:/var/www/html (<- just an example. not a clever idea. :wink: )

so: use a -v option on your windows system and inspect your docker objects. (or google: “docker windows volumes location”.)

1 Like