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

VOLUME uselessly copies data to host #22

Closed
gdlx opened this issue Nov 20, 2020 · 1 comment
Closed

VOLUME uselessly copies data to host #22

gdlx opened this issue Nov 20, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@gdlx
Copy link

gdlx commented Nov 20, 2020

I'm using your TF2 image relying on this one, but the VOLUME ${STEAMCMDDIR} command causes the image contents to be copied on the host in an anonymous volume with ~300MB, and this is duplicated each time the container is restarded, finally causing a huge and useless disk usage or requires regular cleanup:

root@homesrv:/var/lib/docker/volumes/c0501b78b12a806a75c0c954da4b4cb81ff0e6149bd960a6690f32d201c1a432# du -sh *
316M    _data
root@homesrv:/var/lib/docker/volumes/c0501b78b12a806a75c0c954da4b4cb81ff0e6149bd960a6690f32d201c1a432# ll _data
total 32
drwxr-xr-x 7 homesrv homesrv 4096 nov.  20 22:19 ./
drwxr-xr-x 3 root     root     4096 nov.  20 22:18 ../
drwxr-xr-x 2 homesrv homesrv 4096 nov.  20 22:19 linux32/
drwxr-xr-x 2 homesrv homesrv 4096 nov.  20 22:19 linux64/
drwxr-xr-x 2 homesrv homesrv 4096 nov.  20 22:19 package/
drwxr-xr-x 2 homesrv homesrv 4096 nov.  20 22:19 public/
drwxr-xr-x 3 homesrv homesrv 4096 nov.  20 22:18 siteserverui/
-rwxr-xr-x 1 homesrv homesrv 1166 oct.  10  2016 steamcmd.sh*
lrwxrwxrwx 1 homesrv homesrv   32 août  25 09:15 steam.sh -> /home/steam/steamcmd/steamcmd.sh

Overwriting this volume with a customized host directory doesn't work because in this case, the image contents is not copied, so the directory is empty and the image doesn't start.

Is there any good reason for duplicating the image contents on the host, knowing it doesn't bring persistence between container executions or would it be possible to remove this VOLUME instruction ?

Thanks!

@CM2Walki CM2Walki self-assigned this Nov 21, 2020
@CM2Walki CM2Walki added enhancement New feature or request wontfix This will not be worked on labels Nov 21, 2020
@CM2Walki
Copy link
Owner

CM2Walki commented Nov 21, 2020

Hey @gdlx,

I assume with restarting you mean recreating the container which causes it to allocate a new volume (which is intended behaviour). The image doesn't have bind mount support, as you already noticed, because it really doesn't need it. What you are looking for is a named volume:

$ docker volume create steamcmd_volume # Create named volume
$ docker run -it -v "steamcmd_volume:/home/steam/steamcmd" --name=steamcmd cm2network/steamcmd bash # Start the container with the volume mounted

This way it will remain persistent over container recreations. You can even mount the same named steamcmd volume into multiple containers. That way you save space by using the same installation for multiple game servers. (I used this extensively in my steampipe image).

As to the reason why the VOLUME instruction is there, simply because a steamcmd installation is not static content, each time you launch it, it updates itself. Remember in the regular docker storage driver it will create a new layer for every change. So each update to steamcmd would keep growing the layers unnecessarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants