surevine / openfire-docker-compose

Run multiple Openfire servers & DBs in Docker for local testing
9 stars 6 forks source link

File content created that can't be removed #18

Open guusdk opened 4 years ago

guusdk commented 4 years ago

After running an instance (using ./start.sh) an _data folder is created that has content. Some of that content gets file permissions that prevent the user that issued the start from removing it. This causes errors during the setup of subsequent starts, as shown below.

$ ./start.sh 
Starting a federated environment (use -c to start a clustered environment instead).
WARNING: Found orphan containers (openfire-docker-compose_db_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Removing openfire-docker-compose_xmpp1_1 ... done
Removing openfire-docker-compose_xmpp2_1 ... done
Removing openfire-docker-compose_db1_1   ... done
Removing openfire-docker-compose_db2_1   ... done
Removing network openfire-docker-compose_openfire-federated-net
Pulling db1   ... done
Pulling db2   ... done
Pulling xmpp1 ... error
Pulling xmpp2 ... error

ERROR: for xmpp1  pull access denied for openfire, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

ERROR: for xmpp2  pull access denied for openfire, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
ERROR: pull access denied for openfire, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
rm: cannot remove '_data/xmpp/federated/2/conf': Permission denied
rm: cannot remove '_data/xmpp/federated/1/conf': Permission denied
mkdir: cannot create directory ‘_data’: File exists
cp: cannot stat '_data/xmpp/federated/1/conf/available-plugins.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/1/conf/crowd.properties': Permission denied
cp: cannot stat '_data/xmpp/federated/1/conf/openfire-demoboot.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/1/conf/openfire.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/1/conf/security.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/1/conf/security': Permission denied
cp: cannot stat '_data/xmpp/federated/1/conf/server-update.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/2/conf/available-plugins.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/2/conf/crowd.properties': Permission denied
cp: cannot stat '_data/xmpp/federated/2/conf/openfire-demoboot.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/2/conf/openfire.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/2/conf/security.xml': Permission denied
cp: cannot stat '_data/xmpp/federated/2/conf/security': Permission denied
cp: cannot stat '_data/xmpp/federated/2/conf/server-update.xml': Permission denied
Creating network "openfire-docker-compose_openfire-federated-net" with driver "bridge"
WARNING: Found orphan containers (openfire-docker-compose_db_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating openfire-docker-compose_db2_1   ... done
Creating openfire-docker-compose_db1_1 ... done
Creating openfire-docker-compose_xmpp1_1 ... done
Creating openfire-docker-compose_xmpp2_1 ... done
Attaching to openfire-docker-compose_db1_1, openfire-docker-compose_db2_1, openfire-docker-compose_xmpp1_1, openfire-docker-compose_xmpp2_1
db1_1    | The files belonging to this database system will be owned by user "postgres".
db1_1    | This user must also own the server process.
db1_1    | 
db1_1    | The database cluster will be initialized with locale "en_US.utf8".
db1_1    | The default database encoding has accordingly been set to "UTF8".
db1_1    | The default text search configuration will be set to "english".
...
Fishbowler commented 3 years ago

I've reproduced this on Linux when I couldn't on a Mac. The containers run with UID 0, whereas locally we'll likely run in userspace, e.g. UID 1000.

Solution is to map the UID into the container, something like this: https://dev.to/acro5piano/specifying-user-and-group-in-docker-i2e

Needs to be aware of macOS to maintain portability