IPFS Config problems within container. Failure to decode config?

I have created a container and it is running fine via CLI, when I connect to the WebUI I recieve error: “Is your daemon running?”, “Unable to connect to API”.
I am then given commands to enable access between WebUI and IPFS daemon. When I run these commands, and restart the container to enable the changes to the config, the container will constantly restart.

When checking the logs of the container I can see:
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
Error: error loading plugins: failure to decode config: invalid character ‘]’ after object key
Error: error loading plugins: failure to decode config: invalid character ‘]’ after object key

Anyone have an idea what is causing this? I have made previous container run fine with these commands

What commands did you run?

What version of ipfs did you create the container with?

How are you connecting to WebUI ?

Run command used:
(This brings the container up fine, am able to access WebUI fine @ 192.168.x.x:5001/webui):

docker run -d --name power-ipfs -e IPFS_PATH=/data/ipfs -e IPFS_STORAGE_MAX=4G -e IPFS_ANNOUNCE=‘[“/ip4/192.168.x.x/tcp/4001”]’ -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 5001:5001 -v data-ipfs:/data/ipfs power-ipfs

ipfs version:

ipfs version 0.6.0

How are you connecting to WebUI?

I am connecting to the WebUI from my desktop, while my IPFS node is running on a seperate headless system

Open the developer console in the browser and check where the webUI is trying to connect and why it is failing (CORS?).

I am unsure, you show no commands changing the config… if there is a problem with the config, maybe it’s related to those commands.

Also, I am not sure how your docker container is built. Usually, env vars other than IPFS_PATH are not supported.

Sorry about that, I will check the developer console in a few minutes. Here are the Config commands I pass through to the running container:

docker exec -it power-ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin ‘[“https://ipfs.datasecuritynode.com”, “http://192.168.x.x”, “http://127.0.0.1:5001”, “https://webui.ipfs.io”]’

docker exec -it power-ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods ‘[“PUT”, “POST”]’

I have also tried passing through the defaults the the WebUI gives when it complains about not being able to connect with the daemon:

docker exec -it power-ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin ‘[“http://192.168.x.x:5001”, “http://127.0.0.1:5001”, “https://webui.ipfs.io”]’

docker exec -it power-ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods ‘[“PUT”, “POST”]’

Also to be clear, it does take these commands but when restarting the container for the daemon to start using the new configurations is when I get the errors:

Error: error loading plugins: failure to decode config: invalid character ‘]’ after object key
Error: error loading plugins: failure to decode config: invalid character ‘]’ after object key

Please tell me that you are not using these quotes ” ’ and you are running the commands with normal quotes like ' ".

Yes I was using the proper quotations, sorry about that. Also to note, it is possible to go inside the container and manually put the entire config inside and it will work… But I am trying to automate this process

These are the commands I have tried:

docker exec -it power-ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin ‘[“http://192.168.20.151:5001”, “http://127.0.0.1:5001”, “https://webui.ipfs.io”]’

docker exec -it power-ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods ‘[“PUT”, “POST”]’

image

Well, your docker run command is only forwarding port 5001 locally, while it should make it listen on 0.0.0.0 I think.

This has been solved; Thanks @hector

Sorry what was the solution? Running into a similar issue

Same here would like to know the solution, tried adding script to run commands given on error page for CORS through Install IPFS Kubo inside Docker | IPFS Docs. Running in docker compose with ipfs/kubo:latest, works when I am not using docker.