Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions ui/src/components/Header/Controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { PlayArrow, Stop } from '@mui/icons-material';
import {
isALocalStackContainer,
removeTagFromImage,
getImageRepositories,
useDDClient,
useLocalStack,
useMountPoint,
Expand Down Expand Up @@ -125,11 +125,9 @@ export const Controller = (): ReactElement => {
return;
}

const haveImage = images.some(
(image) => removeTagFromImage(image) === LOCALSTACK_IMAGE,
const haveImage = images.some((image) =>
getImageRepositories(image).includes(LOCALSTACK_IMAGE),
);


if (!haveImage) {
setDownloadProps({ open: true, image: LOCALSTACK_IMAGE });
return;
Expand Down
9 changes: 6 additions & 3 deletions ui/src/services/util/containers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ const removeDockerTag = (imageString: string) => {
// If there is a tag, return the part before the last ":" (image without tag)
return parts.slice(0, -1).join(':');
};
export function removeTagFromImage(image: DockerImage){

return removeDockerTag(image.RepoTags?.at(0) || '');
/**
* An image can carry several tags (e.g. localstack/localstack-pro:latest and
* localstack/localstack:latest share one image), so return every repository name.
*/
export function getImageRepositories(image: DockerImage): string[] {
return (image.RepoTags ?? []).map(removeDockerTag);
}

export const isALocalStackContainer = (container: DockerContainer) => {
Expand Down
Loading