Unable to mount ignition/data folder in an external volume using Docker

I'm mounting the /ignition/data/projects folder in an external windows volume (D:\Ignition\Data\Projects) successfully, using the following run statement.

docker run -d -p 8488:8088 `
	--name dau_ind_testing_8121 `
	-v D:\Ignition\Data\Projects:/usr/local/bin/ignition/data/projects `
	-e ACCEPT_IGNITION_EULA=Y `
	-e GATEWAY_ADMIN_USERNAME=admin `
	-e GATEWAY_ADMIN_PASSWORD=password `
	-e IGNITION_EDITION=full `
	-e TZ=America/Bogota `
	inductiveautomation/ignition:8.1.21 `
	-n gw_dau_ind_testing_8121 `
	-a localhost -h 8488 -s 8443  

Is there a way to do the same for the /ignition/data folder? When i mount the volume from the ignition/data folder

	-v D:\Ignition\Data:/usr/local/bin/ignition/data`

keep getting this error for the container.

init     | 2022/10/06 16:32:10 | Parsed systemName argument; new value: gw_dau_ind_testing_8121
init     | 2022/10/06 16:32:10 | Parsed httpAddress argument; new value: localhost
init     | 2022/10/06 16:32:10 | Parsed httpPort argument; new value: 8488
init     | 2022/10/06 16:32:10 | Parsed httpsPort argument; new value: 8443
init     | 2022/10/06 16:32:10 | Creating init.properties file
init     | 2022/10/06 16:32:10 | Adding SystemName=gw_dau_ind_testing_8121 to init.properties
init     | 2022/10/06 16:32:10 | Creating gateway.xml
cp: cannot stat '/usr/local/bin/ignition/data/gateway.xml_clean': No such file or directory

Usage of a bind-mount against the data folder places the empty folder from your host into place in the container. The files (such as gateway.xml_clean) that are in the image at that location are not found when the gateway starts up. Named volumes perform seeding of this information automatically, which is why you can create a named volume and map it into data and have things preserved as you'd expect.

I'd recommend that you use Docker Compose to manage your container here. The primary reason for this is that you'll be able to leverage an init container to perform the same type of "seeding" for your bind-mount that you'd get from a named volume. Take a look at the resources from my ICC session on Running Ignition in a Containerized Environment here: ICC 2022 Containerized Ignition - Session Notes · GitHub. You should be able to also register and access the Virtual ICC and replay that session--I explain this situation in more detail there.

4 Likes

Thanks for the solution and the ICC session.

1 Like

Following question; how the bind-mount volume feature afects the source control with Git? is posible to control the entire data folder?

So a bind-mount just maps a folder from the host system into the container. From the container's perspective, it looks like a mounted disk, like any other on the system. Permissions for that folder are going to be whatever are on the host (keep in mind that on Docker Desktop things are slightly different because you're crossing yet another boundary, container->host Linux VM->host filesystem). It shouldn't affect the usage of git.