Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access files on mounted volume #6

Closed
raaaimund opened this issue Feb 18, 2016 · 11 comments
Closed

Cannot access files on mounted volume #6

raaaimund opened this issue Feb 18, 2016 · 11 comments

Comments

@raaaimund
Copy link

Does the volume on my drive need special permission or a special user / group?
Do I have to create a user for each volume or do I have to launch the docker run command with a special user?

I start the docker with the following command
docker run --name teamspeak -d -p 9987:9987/udp -p 30033:30033 -p 10011:10011 -v /data/teamspeak:/teamspeak3 devalx/docker-teamspeak3:latest

If i inspect the created container the correct folder is mounted in RW mode, but on start the ts3server.ini never can be found and everytime i get error messages...
ERROR: openFile( file:/teamspeak3/logs//ts3server_2016-02-18__20_38_58.281412_0.log) failed

My files are direct in the directory /data/teamspeak ...
/data/teamspeak/ts3server.ini
/data/teamspeak/ts3server.sqlitedb
...

Thank you very much, Raimund

@devalx
Copy link
Owner

devalx commented Feb 18, 2016

Did u use old files from another TS3-Install or was it a "fresh" install (/data/teamspeak was empty before running the container)?
And can u maybe post an "ls -all" from your /data/teamspeak/-directory?

@raaaimund
Copy link
Author

First at all - thank you for your fast reply.
I used the files from another TS3-Install - I wanted to keep my old configurations and the old database.
The permissions are:
alt-text

@raaaimund
Copy link
Author

Here is the command I used to create your docker image.
image

@devalx
Copy link
Owner

devalx commented Feb 18, 2016

So, in general you dont need to keep the complete TS3-folder and put it into the /data/teamspeak-dir, because all runtime-files of the server are meant to stay inside the actual TS3-container. (Like the startscripts)
In the current version the files are created as root by the container, so you could try to "chown -R root /data/teamspeak". (I just started today so they will not be created as root, just need some more time updating the README)
You can also try to delete the logs/-folder so the container can create it with the correct permissions himself (hopefully)

@raaaimund
Copy link
Author

Does the server in the docker image create the folder for the logfiles inside my /data/teamspeak or in a custom folder inside the docker image?
I changed the owner to root:root, but no success - I also removed all other files but now i get a critical error.
2016-02-18 21:47:01.429623|CRITICAL|VirtualSvrMgr | | unable to start filemanager, while creating directory : files failed

image

But if you also dont know any more things which I can try, I will do some more research and try to fix this and will get back to you ^^

@devalx
Copy link
Owner

devalx commented Feb 18, 2016

Sorry, i never tried to import old data ^^
Seems like there is still a permission problem and he cant create the files-folder now.
The container should create the logs inside your /data/teamspeak-folder (Because /teamspeak3 inside the container is mapped to it).

@raaaimund
Copy link
Author

Mh yes, there is a problem with the permissions ... didnt see this error message until now ...
mkdir: cannot create directory '/teamspeak3/files': Permission denied

@devalx
Copy link
Owner

devalx commented Feb 18, 2016

In the new beta-branch i implemented an ENV-variable to set the UID of the internal user in the actual container, maybe it is of any help:
sudo docker run --name=ts3 -d -e TS3_UID=1000 -v /home/devalx/docker/ts3-test:/data/ts3 devalx/docker-teamspeak3:beta
(Make sure to keep a backup of your db ;-)
Keep in mind that the parent-folder (in my example ts3-test) is writable/owned by the specific UID on the host.
Also i am not sure what happens if u specify UID 1111 and there is no actual user with UID 1111 on the host machine.

@raaaimund
Copy link
Author

I figured out why i got problems with my permissions.
I use fedora server as host system and fedora has SElinux enabled.

Here I found the solution.
https://linuxconfig.org/how-to-share-data-between-a-docker-container-and-host-system-using-volumes

I have to create the docker image with the --privileged=true flag.

Now everything works like a charm 👍

Thank you very much for your help @devalx

@devalx
Copy link
Owner

devalx commented Feb 19, 2016

You are welcome, thank you for sharing the solution!
I never used them but maybe the :z|:Z options help you in this case too and you dont need to privilige the whole container, see https://docs.docker.com/engine/userguide/containers/dockervolumes/

@raaaimund
Copy link
Author

Thanks, the solution with the labels is working and is even better. Didnt see, that there is this option.
docker run --name ts3 -d -p 9987:9987/udp -p 30033:30033 -p 10011:10011 -v /data/teamspeak:/teamspeak3:z devalx/docker-teamspeak3

Thank you very much

BastiOfBerlin referenced this issue in BastiOfBerlin/docker-teamspeak3 Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants