Merge pull request #1808 from ich777/overlay2-gui-support

Overlay2 GUI support
This commit is contained in:
tom mortensen
2024-08-01 12:30:57 -07:00
committed by GitHub
4 changed files with 66 additions and 1 deletions
+13
View File
@@ -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:
overlay2 (default): Will use overlay2 as the storage driver for Docker, 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).
: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).
@@ -1119,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
@@ -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');
?>
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.filetree.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.switchbutton.css')?>">
@@ -188,6 +191,23 @@ _(Docker directory)_:
:docker_vdisk_directory_help:
</div>
<div markdown="1" id="backingfs_type" style="display:none">
_(Docker storage driver)_:
: <select id="DOCKER_BACKINGFS" name="DOCKER_BACKINGFS" onchange="updateBackingFS(this.value)">
<?=mk_option(_var($dockercfg,'DOCKER_BACKINGFS'), 'native', _('native'))?>
<?=mk_option(_var($dockercfg,'DOCKER_BACKINGFS'), 'overlay2', _('overlay2'))?>
</select>
<?if ($var['fsState'] != "Started"):?>
<span id="WARNING_BACKINGFS" style="display:none;"><i class="fa fa-warning icon warning"></i>_(Only modify if this is a new installation since this can lead to unwanted behaviour!)_</span>
<?elseif (is_dir(_var($dockercfg,'DOCKER_IMAGE_FILE'))):?>
<span id="WARNING_BACKINGFS" style="display:none;"><i class="fa fa-warning icon warning"></i>_(Switching the Storage Driver requires to delete and rebuild the Docker directory manually!)_</span>
<?endif;?>
:docker_storage_driver_help:
</div>
_(Default appdata storage location)_:
: <input type="text" id="DOCKER_APP_CONFIG_PATH" name="DOCKER_APP_CONFIG_PATH" autocomplete="off" spellcheck="false" value="<?=_var($dockercfg,'DOCKER_APP_CONFIG_PATH')?>" placeholder="_(e.g.)_ /mnt/user/appdata/" data-pickfilter="HIDE_FILES_FILTER" data-pickroot="/mnt" data-pickfolders="true" pattern="^[^\\]*/$">
<?if ($var['fsState'] != "Started"):?>
@@ -418,6 +438,7 @@ _(IPv6 custom network on interface)_ <?=$network?> (_(optional)_):
</div>
<?else: /* DOCKER STARTED */?>
_(Docker version)_:
: <?$arrInfo = $DockerClient->getInfo(); echo $arrInfo['Version']?>
@@ -433,6 +454,11 @@ _(Docker directory)_:
:docker_vdisk_location_active_help:
_(Docker storage driver)_:
: <?=_var($dockercfg,'DOCKER_BACKINGFS')?>
:docker_storage_driver_active_help:
_(Default appdata storage location)_:
: <?=_var($dockercfg,'DOCKER_APP_CONFIG_PATH')?>
@@ -592,6 +618,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);
<?if ($no_dockercfg):?>
$(form).find('input[name="DOCKER_BACKINGFS"]').val($('#DOCKER_IMAGE_TYPE').val()=='folder' ? $("#DOCKER_BACKINGFS").val() : $("#DOCKER_BACKINGFS").val('native'));
<?endif;?>
<?endif;?>
$(form).find('input:hidden[name^="DOCKER_DHCP_"]').each(function(){
var id = '#'+$(this).attr('name')+'_';
@@ -860,6 +889,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 +897,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 +918,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($dockercfg,'DOCKER_BACKINGFS') ?>";
var warning = document.getElementById("WARNING_BACKINGFS");
var checkbox = $(".deleteCheckbox");
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 +942,7 @@ $(function() {
<?if ($DockerStopped):?>
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 {
@@ -9,3 +9,4 @@ DOCKER_ALLOW_ACCESS=""
DOCKER_TIMEOUT=10
DOCKER_READMORE="yes"
DOCKER_PID_LIMIT=""
DOCKER_BACKINGFS="overlay2"
+5
View File
@@ -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 &