From 342619a5675867336111ea7906efe7a5b87f389b Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Tue, 30 Jul 2024 19:05:39 +0200 Subject: [PATCH 01/12] Add WebUI option for overlay2 - switch between native and overlay2 storage drivers --- .../DockerSettings.page | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page index 86813766d..83557494b 100644 --- a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page @@ -188,6 +188,23 @@ _(Docker directory)_: :docker_vdisk_directory_help: + + + _(Default appdata storage location)_: : @@ -860,6 +877,7 @@ function btrfsScrub(path) { function updateLocation(val) { var content1 = $("#DOCKER_IMAGE_FILE1"); var content2 = $("#DOCKER_IMAGE_FILE2"); + var dropdown = $("#DOCKER_BACKINGFS"); switch (val) { case 'xfs': var path = content2.val().split('/'); @@ -867,15 +885,18 @@ function updateLocation(val) { content1.val((path.join('/') + '/docker-xfs.img')); $('#vdisk_file').show('slow'); $('#vdisk_dir').hide('slow'); + $('#backingfs_type').hide(); content1.prop('disabled',false).trigger('change'); content2.prop('disabled',true); + dropdown.val('native'); break; case 'folder': var path = content2.val().split('/'); if (path[path.length-1]=='') path.splice(-2,2); else path.splice(-1,1); - content2.val(path.join('/') + '/docker/'); + content2.val(path.join('/')); $('#vdisk_file').hide('slow'); $('#vdisk_dir').show('slow'); + $('#backingfs_type').show('slow'); content1.prop('disabled',true); content2.prop('disabled',false).trigger('change'); break; @@ -885,11 +906,23 @@ function updateLocation(val) { content1.val((path.join('/') + '/docker.img')); $('#vdisk_file').show('slow'); $('#vdisk_dir').hide('slow'); + $('#backingfs_type').hide(); content1.prop('disabled',false).trigger('change'); content2.prop('disabled',true); + dropdown.val('native'); break; } } +function updateBackingFS(val) { + var backingfs = ""; + var warning = document.getElementById("WARNING_BACKINGFS"); + var checkbox = $(".deleteCheckbox"); // Auswahl der Checkbox über die Klasse + if (val !== backingfs) { + warning.style.display = "inline"; + } else { + warning.style.display = "none"; + } +} function checkbox_state(value) { $.post('/plugins/dynamix.docker.manager/include/UpdateConfig.php',{action:'exist',name:value},function(state){state==0 ? $('.deleteLabel').fadeIn() : $('.deleteLabel').fadeOut();}); } @@ -897,6 +930,7 @@ $(function() { if ($('#DOCKER_IMAGE_TYPE').val()=='folder') { $('#vdisk_dir').show(); + $('#backingfs_type').show(); checkbox_state($("#DOCKER_IMAGE_FILE2").val()); $("#DOCKER_IMAGE_FILE2").prop('disabled',false); } else { From 49793ff602c0610a7ab248882d66035399272948 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Tue, 30 Jul 2024 19:07:49 +0200 Subject: [PATCH 02/12] Add DOCKER_BACKINGFS with native option --- emhttp/plugins/dynamix.docker.manager/default.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/emhttp/plugins/dynamix.docker.manager/default.cfg b/emhttp/plugins/dynamix.docker.manager/default.cfg index fcaca76a8..a8116133b 100644 --- a/emhttp/plugins/dynamix.docker.manager/default.cfg +++ b/emhttp/plugins/dynamix.docker.manager/default.cfg @@ -9,3 +9,4 @@ DOCKER_ALLOW_ACCESS="" DOCKER_TIMEOUT=10 DOCKER_READMORE="yes" DOCKER_PID_LIMIT="" +DOCKER_BACKINGFS="native" From 79c484e2e51046533fdff825e868a065ca4662d7 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Tue, 30 Jul 2024 19:22:40 +0200 Subject: [PATCH 03/12] Add helptext for Docker storage driver --- emhttp/languages/en_US/helptext.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emhttp/languages/en_US/helptext.txt b/emhttp/languages/en_US/helptext.txt index e4978f58d..22c6edcf7 100644 --- a/emhttp/languages/en_US/helptext.txt +++ b/emhttp/languages/en_US/helptext.txt @@ -1038,6 +1038,15 @@ You must specify a folder for Docker. The system will automatically create this It is recommended to create this folder under a share which resides on the Cache pool (setting: cache=Only). For best performance SSD devices are preferred. :end +:docker_storage_driver_help: +native (default): The native storage driver for your underlying filesystem will be used (XFS: overlay2 | ZFS: zfs | BTRFS: btrfs). + +overlay2 (recommended): Will force the usage from overlay2 regardless of the underlying filesystem. + +ATTENTION: Changing the storage type from an existing Docker installation is not possible, you have to delete your Docker directory first, change the storage type and then reinstall your containers. +It is recommended to take a screenshot from your Docker containers before changing the storage type. After deleting and changing the storage type, reinstall the containers by clicking Add Container on the Docker page and select one by one from the drop down to reinstall them with your previous settings). +:end + :docker_appdata_location_help: You can specify a folder to automatically generate and store subfolders containing configuration files for each Docker app (via the /config mapped volume). From 858a3aa99992ce4ca97d3137b2857bbfbb19ac26 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Tue, 30 Jul 2024 21:19:57 +0200 Subject: [PATCH 04/12] Display storage driver with started array --- emhttp/plugins/dynamix.docker.manager/DockerSettings.page | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page index 83557494b..123c71177 100644 --- a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page @@ -446,6 +446,9 @@ _(Docker vDisk location)_: _(Docker directory)_: : + +_(Docker storage driver)_: +: :docker_vdisk_location_active_help: From 1e41ac637db3b77428dcd85ba983498b9e64fc7d Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Tue, 30 Jul 2024 21:26:10 +0200 Subject: [PATCH 05/12] Bugfix for helptexts --- emhttp/plugins/dynamix.docker.manager/DockerSettings.page | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page index 123c71177..0387aba99 100644 --- a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page @@ -447,11 +447,13 @@ _(Docker vDisk location)_: _(Docker directory)_: : +:docker_vdisk_location_active_help: + _(Docker storage driver)_: : - -:docker_vdisk_location_active_help: +:docker_storage_driver_active_help: + _(Default appdata storage location)_: : From e0b16126336e86b434c8f66d432b257bfef8cd9f Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Tue, 30 Jul 2024 21:26:54 +0200 Subject: [PATCH 06/12] Add helptext for docker storage driver when active --- emhttp/languages/en_US/helptext.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emhttp/languages/en_US/helptext.txt b/emhttp/languages/en_US/helptext.txt index 22c6edcf7..75b9ea517 100644 --- a/emhttp/languages/en_US/helptext.txt +++ b/emhttp/languages/en_US/helptext.txt @@ -1128,6 +1128,10 @@ This is the active Docker version. This is the location of the Docker image. :end +:docker_storage_driver_active_help: +This is the storage driver for Docker. +:end + :docker_appdata_location_active_help: This is the storage location for Docker containers. :end From 9a6b62ae98d73f6c09dc76c457e2acd529f56141 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Wed, 31 Jul 2024 10:55:30 +0200 Subject: [PATCH 07/12] Bugfix for new installations --- emhttp/plugins/dynamix.docker.manager/DockerSettings.page | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page index 0387aba99..b13edeec5 100644 --- a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page @@ -103,6 +103,9 @@ function base_net($route) { return substr(explode('/',$route)[0],0,-2); } $bgcolor = strstr('white,azure',$display['theme']) ? '#f2f2f2' : '#1c1c1c'; + +//Check if docker.cfg not exists +$no_dockercfg = !is_file('/boot/config/docker.cfg'); ?> @@ -614,6 +617,9 @@ function prepareDocker(form) { $(form).find('input[name="DOCKER_IMAGE_FILE"]').val($('#DOCKER_IMAGE_TYPE').val()=='folder' ? $("#DOCKER_IMAGE_FILE2").val() : $("#DOCKER_IMAGE_FILE1").val()); $("#DOCKER_IMAGE_FILE1").prop('disabled',true); $("#DOCKER_IMAGE_FILE2").prop('disabled',true); + + $(form).find('input[name="DOCKER_BACKINGFS"]').val($('#DOCKER_IMAGE_TYPE').val()=='folder' ? $("#DOCKER_BACKINGFS").val() : $("#DOCKER_BACKINGFS").val('native')); + $(form).find('input:hidden[name^="DOCKER_DHCP_"]').each(function(){ var id = '#'+$(this).attr('name')+'_'; From 3314860d313a82a13c65cb9598815bc5caa3738c Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Wed, 31 Jul 2024 10:56:03 +0200 Subject: [PATCH 08/12] Change the default to overlay2 --- emhttp/plugins/dynamix.docker.manager/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix.docker.manager/default.cfg b/emhttp/plugins/dynamix.docker.manager/default.cfg index a8116133b..f5516dc0b 100644 --- a/emhttp/plugins/dynamix.docker.manager/default.cfg +++ b/emhttp/plugins/dynamix.docker.manager/default.cfg @@ -9,4 +9,4 @@ DOCKER_ALLOW_ACCESS="" DOCKER_TIMEOUT=10 DOCKER_READMORE="yes" DOCKER_PID_LIMIT="" -DOCKER_BACKINGFS="native" +DOCKER_BACKINGFS="overlay2" From b4722f57aaa1de33224497bbd9599db6f9f6563f Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Wed, 31 Jul 2024 10:59:38 +0200 Subject: [PATCH 09/12] Set default backingfs type to native for existing installations --- etc/rc.d/rc.local | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/rc.d/rc.local b/etc/rc.d/rc.local index 0ead18c64..ffcf5a987 100755 --- a/etc/rc.d/rc.local +++ b/etc/rc.d/rc.local @@ -61,6 +61,11 @@ mkdir -p $CONFIG/shares mkdir -p $CONFIG/ssh/root mkdir -p $CONFIG/ssl/certs +# Set default Docker backingfs type to native for existing installations +if [[ -f "/boot/config/docker.cfg" ]]; then + grep -q "DOCKER_BACKINGFS=" /boot/config/docker.cfg || echo "DOCKER_BACKINGFS=\"native\"" >> /boot/config/docker.cfg +fi + # upgrade network configuration (if needed) and (re)generates our welcome text if [[ -x /usr/local/sbin/create_network_ini ]]; then /usr/local/sbin/create_network_ini init &>/dev/null & From 76f58d2995289625051b5c99fb7c36fda368ea70 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Wed, 31 Jul 2024 11:05:54 +0200 Subject: [PATCH 10/12] overlay2 default --- emhttp/languages/en_US/helptext.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emhttp/languages/en_US/helptext.txt b/emhttp/languages/en_US/helptext.txt index 75b9ea517..5b6203b83 100644 --- a/emhttp/languages/en_US/helptext.txt +++ b/emhttp/languages/en_US/helptext.txt @@ -1039,9 +1039,9 @@ It is recommended to create this folder under a share which resides on the Cache :end :docker_storage_driver_help: -native (default): The native storage driver for your underlying filesystem will be used (XFS: overlay2 | ZFS: zfs | BTRFS: btrfs). +overlay2 (default): Will use overlay2 as the storage driver for Docker, regardless of the underlying filesystem. -overlay2 (recommended): Will force the usage from overlay2 regardless of the underlying filesystem. +native: The native storage driver for your underlying filesystem will be used (XFS: overlay2 | ZFS: zfs | BTRFS: btrfs). ATTENTION: Changing the storage type from an existing Docker installation is not possible, you have to delete your Docker directory first, change the storage type and then reinstall your containers. It is recommended to take a screenshot from your Docker containers before changing the storage type. After deleting and changing the storage type, reinstall the containers by clicking Add Container on the Docker page and select one by one from the drop down to reinstall them with your previous settings). From f9107ebe115215ce0e4f39ce1a66da8b17284786 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Wed, 31 Jul 2024 12:02:05 +0200 Subject: [PATCH 11/12] Always display storage driver when Docker is active --- emhttp/plugins/dynamix.docker.manager/DockerSettings.page | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page index b13edeec5..e4e83057d 100644 --- a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page @@ -438,6 +438,7 @@ _(IPv6 custom network on interface)_ (_(optional)_): + _(Docker version)_: : getInfo(); echo $arrInfo['Version']?> @@ -449,6 +450,7 @@ _(Docker vDisk location)_: _(Docker directory)_: : + :docker_vdisk_location_active_help: @@ -456,7 +458,6 @@ _(Docker storage driver)_: : :docker_storage_driver_active_help: - _(Default appdata storage location)_: : From f81118ffe3e74b29c1c5e9a4bd54828e12e77902 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Wed, 31 Jul 2024 21:33:50 +0200 Subject: [PATCH 12/12] Remove unnecessary comment --- emhttp/plugins/dynamix.docker.manager/DockerSettings.page | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page index e4e83057d..21d392048 100644 --- a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page @@ -928,7 +928,7 @@ function updateLocation(val) { function updateBackingFS(val) { var backingfs = ""; var warning = document.getElementById("WARNING_BACKINGFS"); - var checkbox = $(".deleteCheckbox"); // Auswahl der Checkbox über die Klasse + var checkbox = $(".deleteCheckbox"); if (val !== backingfs) { warning.style.display = "inline"; } else {