fix: respect DOKKU_LIB_HOST_ROOT for storage bind mounts
When Dokku runs in Docker with a shared socket, create/chown still use DOKKU_LIB_ROOT inside the container, but Docker -v flags for storage:exec and deploy must use DOKKU_LIB_HOST_ROOT so the daemon mounts the host data volume instead of the real host's /var/lib/dokku. Closes #9126.
This commit is contained in:
8 files changed
+103
-3
No files matched your search
@@ -61,6 +61,17 @@ func TestBuildDockerVFlagVolumeOptions(t *testing.T) {
|
||||
Expect(roOpts).To(Equal("-v /host:/container:ro,noexec,nosuid"))
|
||||
}
|
||||
|
||||
func TestBuildDockerVFlagRewritesLibHostRoot(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
|
||||
t.Setenv("DOKKU_LIB_ROOT", "/var/lib/dokku")
|
||||
t.Setenv("DOKKU_LIB_HOST_ROOT", "/host/var/lib/dokku")
|
||||
|
||||
entry := &Entry{HostPath: "/var/lib/dokku/data/storage/demo"}
|
||||
flag := buildDockerVFlag(entry, &Attachment{ContainerPath: "/app/data"})
|
||||
Expect(flag).To(Equal("-v /host/var/lib/dokku/data/storage/demo:/app/data"))
|
||||
}
|
||||
|
||||
func TestTriggerDockerArgsRejectsSchedulerMismatch(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
root := withTempLibRoot(t)
|
||||
|
||||
Reference in new issue
Block a user