Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

[DnsDock] Fix for image name including forward slash #115

Merged
merged 2 commits into from
May 24, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Strip the slash from image name
  • Loading branch information
Artur 'Wodor' Wielogorski committed May 24, 2016
commit 3a3a016c706a017eb2383ff10f25905325ede703
5 changes: 5 additions & 0 deletions spec/Dock/Docker/Dns/DnsDockResolverSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ function it_removes_the_tag_in_image_name()
{
$this->getDnsByContainerNameAndImage('container', 'image:latest')->shouldContain('container.image.docker');
}

function it_removes_the_slash_in_image_name()
{
$this->getDnsByContainerNameAndImage('container', 'someone/image:latest')->shouldContain('container.someone_image.docker');
}
}
6 changes: 6 additions & 0 deletions src/Docker/Dns/DnsDockResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class DnsDockResolver implements ContainerAddressResolver
public function getDnsByContainerNameAndImage($containerName, $imageName)
{
$imageName = $this->stripTagNameFromImageName($imageName);
$imageName = $this->stripSlashFromImageName($imageName);

return [
$imageName.'.docker',
Expand All @@ -30,4 +31,9 @@ private function stripTagNameFromImageName($imageName)

return $imageName;
}

private function stripSlashFromImageName($imageName)
{
return str_replace('/', '_', $imageName);
}
}