mirror of
https://github.com/woodchen-ink/docker-image.git
synced 2025-07-18 14:01:59 +08:00
修复错误
This commit is contained in:
parent
af3de52fc9
commit
d1eba7746d
@ -115,7 +115,7 @@ function getHomePageHtml(): string {
|
|||||||
function generateCommands() {
|
function generateCommands() {
|
||||||
const imageInput = document.getElementById('imageInput').value;
|
const imageInput = document.getElementById('imageInput').value;
|
||||||
const source = getSourceFromImage(imageInput);
|
const source = getSourceFromImage(imageInput);
|
||||||
const imageName = getImageNameFromInput(imageInput);
|
const imageName = getImageNameFromInput(imageInput, source);
|
||||||
const dockerPullCommand = \`docker pull \${source}/\${imageName}\`;
|
const dockerPullCommand = \`docker pull \${source}/\${imageName}\`;
|
||||||
const dockerTagCommand = \`docker tag \${source}/\${imageName} \${imageName}\`;
|
const dockerTagCommand = \`docker tag \${source}/\${imageName} \${imageName}\`;
|
||||||
const dockerRmiCommand = \`docker rmi \${source}/\${imageName}\`;
|
const dockerRmiCommand = \`docker rmi \${source}/\${imageName}\`;
|
||||||
@ -140,8 +140,18 @@ function getHomePageHtml(): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageNameFromInput(imageInput) {
|
function getImageNameFromInput(imageInput, source) {
|
||||||
return imageInput.replace(/^.+?\\//, '');
|
if (imageInput.startsWith("gcr.io/")) {
|
||||||
|
return imageInput.replace("gcr.io/", "");
|
||||||
|
} else if (imageInput.startsWith("k8s.gcr.io/")) {
|
||||||
|
return imageInput.replace("k8s.gcr.io/", "");
|
||||||
|
} else if (imageInput.startsWith("quay.io/")) {
|
||||||
|
return imageInput.replace("quay.io/", "");
|
||||||
|
} else if (imageInput.startsWith("ghcr.io/")) {
|
||||||
|
return imageInput.replace("ghcr.io/", "");
|
||||||
|
} else {
|
||||||
|
return imageInput;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard(elementId) {
|
function copyToClipboard(elementId) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user