Skip to content

Cannot access files on mounted volume #6

Closed

Description

@raaaimund

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

Activity

  1. devalx commented on Feb 18, 2016

    @devalx
    Owner

    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?

  2. raaaimund commented on Feb 18, 2016

    @raaaimund
    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

  3. raaaimund commented on Feb 18, 2016

    @raaaimund
    Author

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

  4. devalx commented on Feb 18, 2016

    @devalx
    Owner

    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)

  5. raaaimund commented on Feb 18, 2016

    @raaaimund
    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 ^^

  6. devalx commented on Feb 18, 2016

    @devalx
    Owner

    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).

  7. raaaimund commented on Feb 18, 2016

    @raaaimund
    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

  8. devalx commented on Feb 18, 2016

    @devalx
    Owner

    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.

  9. raaaimund commented on Feb 18, 2016

    @raaaimund
    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

  10. devalx commented on Feb 19, 2016

    @devalx
    Owner

    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/

  11. raaaimund commented on Feb 19, 2016

    @raaaimund
    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

  12. added a commit that references this issue on Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions