Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Server mount volume #9

Closed
WolfVanH opened this issue Feb 25, 2020 · 6 comments · Fixed by #26
Closed

Server mount volume #9

WolfVanH opened this issue Feb 25, 2020 · 6 comments · Fixed by #26
Assignees
Labels
question Further information is requested

Comments

@WolfVanH
Copy link

I'm having some trouble mounting the STEAMAPPDIR to a different location outside my container.
Im running the server through Unraid, and haven't been able to modify the location of install.

I've tried both setting a mounting path to /home/steam/csgo-dedicated
and using a volume mount pointing to /home/steam/csgo-dedicated

Thank you for the help

@CM2Walki
Copy link
Owner

I have never worked with Unraid, but I assume you want to expose the STEAMAPPDIR so it can be modified from outside the container?
If that is the case then show me your docker run command, maybe I can help you out by replicating the steps on my server (regular RAID1).

@WolfVanH
Copy link
Author

WolfVanH commented Feb 25, 2020

$ docker run -d --name='dragonCsGo' --net='host' -e TZ="Europe/Paris" -e HOST_OS="Unraid" -e 'SRCDS_TOKEN'='TOKEN HERE' -e 'TCP_PORT_27015'='27015' -e 'TCP_PORT_27020'='27020' -e 'SRCDS_FPSMAX'='300' -e 'SRCDS_TICKRATE'='128' -e 'SRCDS_MAXPLAYERS'='14' -e 'SRCDS_STARTMAP'='de_dust2' -e 'SRCDS_REGION'='3' -e 'SRCDS_MAPGROUP'='mg_active' -v '/mnt/user/appdata/csgo':'/home/steam/csgo-dedicated':'rw' 'cm2network/csgo:sourcemod'

Unraid works more with GUI templates for docker, so there is a lot of stuff there that's not relevant.

In console it logs the following issue: /bin/sh: 1: /home/steam/csgo-dedicated/entry.sh: not found

@CM2Walki CM2Walki self-assigned this Feb 26, 2020
@CM2Walki CM2Walki added the question Further information is requested label Feb 26, 2020
@CM2Walki
Copy link
Owner

Yes, this behaviour is intended by docker, the bind-mount follows the documentation in this regard:

"If you bind-mount into a non-empty directory on the container, the directory’s existing contents are obscured by the bind mount." (Source)

This is the reason why the container can no longer find the "entry.sh" inside the container, since the directory is now empty because it was obscured by the host.

What you are looking for is probably this:
You want the bind mount/directory to be shared between host and container. This can be achieved using the following the instructions:

mkdir -p /mnt/user/appdata/csgo
chown 1000 -R /mnt/user/appdata/csgo
docker run -d --name='dragonCsGo' --net='host' -e TZ="Europe/Paris" -e HOST_OS="Unraid" -e 'SRCDS_TOKEN'='TOKEN HERE' -e 'TCP_PORT_27015'='27015' -e 'TCP_PORT_27020'='27020' -e 'SRCDS_FPSMAX'='300' -e 'SRCDS_TICKRATE'='128' -e 'SRCDS_MAXPLAYERS'='14' -e 'SRCDS_STARTMAP'='de_dust2' -e 'SRCDS_REGION'='3' -e 'SRCDS_MAPGROUP'='mg_active' -v '/mnt/user/appdata/csgo':'/home/steam/csgo-dedicated':'rshared' 'cm2network/csgo:sourcemod'

Quick explanation:
We first create the directory to be mounted by the container and change the ownership to uid 1000. This is possible because of CM2Walki/steamcmd#5, which sets the default uid for the base image to 1000. If you don't change the owner, your container won't be able to write to that directory. Lastly, we set the bind mount to rshared to propagate changes both ways.

Is this what you have been looking for?

@CM2Walki
Copy link
Owner

CM2Walki commented Feb 26, 2020

Hmm, it worked with an older image but not with the current one. It appears that part of the issue is that the entrypoint (entry.sh) is located inside the volume. One solution would be to bind the csgo subdirectory (because I assume that is probably what you want to expose since it holds all the maps, configs and addons)

docker run -d --name='dragonCsGo' --net='host' -e TZ="Europe/Paris" -e HOST_OS="Unraid" -e 'SRCDS_TOKEN'='TOKEN HERE' -e 'TCP_PORT_27015'='27015' -e 'TCP_PORT_27020'='27020' -e 'SRCDS_FPSMAX'='300' -e 'SRCDS_TICKRATE'='128' -e 'SRCDS_MAXPLAYERS'='14' -e 'SRCDS_STARTMAP'='de_dust2' -e 'SRCDS_REGION'='3' -e 'SRCDS_MAPGROUP'='mg_active' --user=root -v '/opt/testvol':'/home/steam/csgo-dedicated/csgo':'rshared' 'cm2network/csgo:sourcemod'

@biro456
Copy link

biro456 commented Mar 28, 2020

As far as I could understand it, the entry.sh doesn't need to be inside STEAMCMDDIR.
Placing anywhere else should allow binding the volume with read-write.

@CM2Walki
Copy link
Owner

Yeah, I'm aware of it. My thinking behind it was that, in case of a faulty update that causes the container to get stuck in a restart loop, you would be able to just edit the entry.sh because it's located in a volume (and fix the cause of the issue). Rather than having to commit & recreate the container which is always a bit of a hassle imo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants