Could not write file [/usr/share/elasticsearch/config/users] bind mounted using docker-compose

Continuing the discussion from "Device or resource busy" when adding to keystore in Docker Compose:

I received a similar exception trying to execute a bin/elasticsearch-users useradd command:

Exception in thread "main" could not write file [/usr/share/elasticsearch/config/users]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(
	at org.elasticsearch.cli.MultiCommand.execute(
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(
	at org.elasticsearch.cli.Command.main(
Caused by: java.nio.file.FileSystemException: /usr/share/elasticsearch/config/users11882566129646724999tmp -> /usr/share/elasticsearch/config/users: Device or resource busy
	at java.base/sun.nio.fs.UnixException.translateToIOException(
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(
	at java.base/sun.nio.fs.UnixCopyFile.move(
	at java.base/sun.nio.fs.UnixFileSystemProvider.move(
	at java.base/java.nio.file.Files.move(

The users file is bind-mounted into the container.
Is there a solution to this that uses docker-compose without a custom Dockerfile?

Have you checked if the bind mount is writable? I think that works via docker inspect on top of my head...

It seems to be... :thinking:

                "Type": "bind",
                "Source": "/home/ubuntu/ro-elasticsearch/users",
                "Destination": "/usr/share/elasticsearch/config/users",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.