NextCloud Docker container connectivity

Hello, I am new with next cloud. I created nextcloud, mongo and my own container using docker-compose for mongodb backup. I am trying to communicate between my container and nextcloud to upload the backup.
It giving me an error for untrusted domain. I already checked the existed solutions and try to update the config.php file and put my domain. still I am getting the same error.
I have these three containers.


I am trying to communicate using this link to upload the backup on next cloud
curl -X PUT -u user:pass http://nextcloud:80/remote.php/dav/files/user/fbackup.zip -T backup.zip

This is my compose file:

version: “3”
services:
mongo:
container_name: “mongo”
image: “mongo:latest”
nextcloud:
container_name: “nextcloud”
image: “nextcloud:latest”
ports:
- “8080:80”
volumes:
- ./data:/var/www/html/data
- ./config:/var/www/html/config
backup:
container_name: “backup”
image: “5d65788541d8”

Can anyone tell me where I am doing wrong or what I have to do to communicate correctly. Thank you!

Well, perhaps start by sharing your compose file. Might be a better question for the docker community. You could also post there and link back here to have the conversation on both ends.

I upload my compose file in my question. Yes, I will also ask in docker community. Thanks

Or you use Nextcloud AIO which is already preconfigured to enable easy backups etc. using docker.

Well, what is the setting for your trusted domain in the config/config.php (see docs)? It should contain nextcloud in order to allow access via the domain name nextcloud.

Yes, I put my domain in trusted domain section in config file. It looks like this
‘trusted_domains’ =>
array (
0 => ‘localhost:8080’,
1 => ‘nextcloud:80’,
),

If this command is used within the mongo of backup containers, it will use the domain name nextcloud (right after http://). Otherwise, you would have to use either the IP in the curl request or something entirely different when you accessed through the host device (and port 8080).

Sorry, my mistake I used nextcloud:80 in my trusted domain still it didn’t work. I also used that IP but not working. If i use port 8080 it gave me error of refuse connection. if i use 80 it gave untrusted domain error. I tried all the combinations like with localhost, IP, nextcloud, port 8080, port 80 to just access the nextcloud but nothing worked.
If I try to upload without docker it works perfectly no error but with docker containers its not accessing or communicating with nextcloud.

Can you have a look at the NC logs (under data/nextcloud.log) if there is something logged while you try to access it? Maybe you increase the debugging level of nextcloud to debug before to maximize the output…

my log file has log written in it. How I can increase debugging level and how it can help.

The setting is called log_level in config/config.php. It could be set to 0 for the most verbose logging.

I was hoping to get a hint on why the instance is refusing access.

Did you put nextcloud of nextcloud:80 to the trusted domain list? It must be nextcloud without the port.

You could for the time being add all versions if you are testing and then get one combination working. Then, you start to comment things out until you narrow it down to the minimal config.

Thank you! it works perfectly with nextcloud without any port.

1 Like