Add always-pull option to Duplicate/Edit container modal.
Release rolling / release (push) Has been cancelled

Match Add container so users can reuse a local image when duplicating.
This commit is contained in:
Raven Scott
2026-07-15 14:40:46 -04:00
parent b185ea7a55
commit 5e13fc0919
4 changed files with 21 additions and 1 deletions
+2
View File
@@ -44,6 +44,8 @@ What PearDock can do today, mapped to code and protocol surfaces.
**Add container** (`#add-container-view`, `libs/addContainer.js`) is a blank create form separate from **Deploy** templates: name, image, **Always pull the image**, ports (manual + publish-all-exposed), auto-remove, and advanced sections (command, volumes, network, env, labels, restart, runtime/resources). Submit uses `deployContainer` via the job tray. **Add container** (`#add-container-view`, `libs/addContainer.js`) is a blank create form separate from **Deploy** templates: name, image, **Always pull the image**, ports (manual + publish-all-exposed), auto-remove, and advanced sections (command, volumes, network, env, labels, restart, runtime/resources). Submit uses `deployContainer` via the job tray.
**Duplicate / Edit** (`#duplicateModal`, `libs/templateDeploy.js`) reuses the same deploy path with a full config editor (name, image, **Always pull the image**, ports, volumes, env, resources, security, health, etc.). When always-pull is off, the server uses a local image if present.
Deploy templates form remains under the Deploy tab for catalog-driven deploys. Deploy templates form remains under the Deploy tab for catalog-driven deploys.
--- ---
+9
View File
@@ -2799,6 +2799,15 @@ services:
<small class="text-muted">Docker image name and tag</small> <small class="text-muted">Docker image name and tag</small>
</div> </div>
</div> </div>
<div class="row">
<div class="col-12 mb-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="duplicate-always-pull" checked>
<label class="form-check-label" for="duplicate-always-pull">Always pull the image</label>
</div>
<small class="text-muted">When on, pull from the registry before create. When off, use a local image if present.</small>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-4 mb-3"> <div class="col-md-4 mb-3">
<label for="duplicate-command" class="form-label">Command Override</label> <label for="duplicate-command" class="form-label">Command Override</label>
+7
View File
@@ -3044,6 +3044,7 @@ function collectDuplicateFormData() {
const data = { const data = {
containerName: document.getElementById('duplicate-container-name')?.value.trim() || '', containerName: document.getElementById('duplicate-container-name')?.value.trim() || '',
image: document.getElementById('duplicate-image')?.value.trim() || '', image: document.getElementById('duplicate-image')?.value.trim() || '',
alwaysPull: document.getElementById('duplicate-always-pull')?.checked !== false,
command: document.getElementById('duplicate-command')?.value.trim() || null, command: document.getElementById('duplicate-command')?.value.trim() || null,
entrypoint: document.getElementById('duplicate-entrypoint')?.value.trim() || null, entrypoint: document.getElementById('duplicate-entrypoint')?.value.trim() || null,
workingDir: document.getElementById('duplicate-workdir')?.value.trim() || null, workingDir: document.getElementById('duplicate-workdir')?.value.trim() || null,
@@ -3127,6 +3128,8 @@ function collectDuplicateFormData() {
delete data[key]; delete data[key];
} }
}); });
// Keep boolean alwaysPull even when false (deploy path treats undefined as force-pull)
data.alwaysPull = document.getElementById('duplicate-always-pull')?.checked !== false;
return data; return data;
} }
@@ -3314,6 +3317,10 @@ function populateDuplicateForm(config, opts = {}) {
const imageEl = document.getElementById('duplicate-image'); const imageEl = document.getElementById('duplicate-image');
if (imageEl) imageEl.value = config.Config?.Image || ''; if (imageEl) imageEl.value = config.Config?.Image || '';
// Default on (match Add container); user can turn off to reuse a local image
const alwaysPullEl = document.getElementById('duplicate-always-pull');
if (alwaysPullEl) alwaysPullEl.checked = true;
const commandEl = document.getElementById('duplicate-command'); const commandEl = document.getElementById('duplicate-command');
if (commandEl && config.Config?.Cmd) { if (commandEl && config.Config?.Cmd) {
commandEl.value = Array.isArray(config.Config.Cmd) ? config.Config.Cmd.join(' ') : config.Config.Cmd; commandEl.value = Array.isArray(config.Config.Cmd) ? config.Config.Cmd.join(' ') : config.Config.Cmd;
+2
View File
@@ -20,6 +20,8 @@ const REQUIRED_IDS = [
'add-container-btn', 'add-container-btn',
'add-container-form', 'add-container-form',
'addc-always-pull', 'addc-always-pull',
'duplicate-always-pull',
'duplicate-container-form',
'deploy-view', 'deploy-view',
'tunnels-view', 'tunnels-view',
'swarm-view', 'swarm-view',