Can't edit file in docker-endpoints

I am using crudini to edit a config file in docker-entrypoint.sh with docker swarm

With these commands:

  1. exec gosu root crudini
  2. gosu root crudini
  3. crudini

They all are failed and I get this error

error: failed switching to "root": operation not permitted

How can I fix it? Thanks!