Migration to bind mounted data dir

By default, the generated GameBench docker-compose.yml will be configured to mount the data directory to a Docker volume. The purpose of this guide is to outline the steps necessary to switch the data volume to a bind mounted data directory. This could, for example, allow you to store data on a mounted NFS share.

1. Identify file data location on disk

Find volume name


$ docker volume ls | grep filedata
(out)local               gb_filedata

Inspect volume

Use the volume name from the previous command to identify the mountpoint.


$ # Replace gb_filedata with the name of your Docker volume
$ docker volume inspect gb_filedata
(out)[
(out)    {
(out)        "CreatedAt": "2019-08-23T14:26:33Z",
(out)        "Driver": "local",
(out)        "Labels": {
(out)            "com.docker.compose.project": "gb",
(out)            "com.docker.compose.version": "1.23.2",
(out)            "com.docker.compose.volume": "filedata"
(out)        },
(out)        "Mountpoint": "/var/lib/docker/volumes/gb_filedata/_data",
(out)        "Name": "gb_filedata",
(out)        "Options": null,
(out)        "Scope": "local"
(out)    }
(out)]

2. Copy contents to new location

Use the mountpoint from the previous command to copy the data to the new directory.


$ # Replace /var/lib/docker/volumes/gb_filedata/_data/ and /home/vagrant/gb-data/ with your volume mountpoint and new directory path
$ sudo cp -r /var/lib/docker/volumes/gb_filedata/_data/. /home/vagrant/gb-data/

3. Run gbctl in your gamebench directory to reconfigure

Set the GameBench directory to the new directory path.


$ # Replace /home/vagrant/gb-data with your new directory path
$ ./gbctl
(out)Bind mount GameBench directory?
(out)        Use this setting if you want to bind mount the GameBench directory on the host.
(out)        (Default: no) (Current: no) yes
(out)GameBench directory
(out)        (Default: ) (Current: ) /home/vagrant/gb-data

4. Restart changed containers


$ docker-compose up -d

5. Update new location with any files uploaded since the previous copy


$ # Replace /var/lib/docker/volumes/gb_filedata/_data/ and /home/vagrant/gb-data/ with your volume mountpoint and new directory path
$ sudo rsync -a --ignore-existing /var/lib/docker/volumes/gb_filedata/_data/ /home/vagrant/gb-data/