Skip to content

Commit

Permalink
feat: Support Podman for pulling images
Browse files Browse the repository at this point in the history
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
  • Loading branch information
pojntfx committed Jan 7, 2025
1 parent 874d9f5 commit dbd9060
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,25 @@ Usage: %s [OPTION...] "<COMMAND...>"
}

if !shouldPullAndTag {
// We need to enable `docker.io` as an unqualified search registry manually
// since `podman-docker` doesn't emulate Docker in this behavior fully
registriesConf, err := os.CreateTemp("", "registries.conf")
if err != nil {
log.Fatalln("could not create temporary registries.conf:", err)
}
defer os.Remove(registriesConf.Name())

if _, err := registriesConf.WriteString(`short-name-mode = "permissive"
unqualified-search-registries = ["docker.io"]
`); err != nil {
log.Fatalln("could not write to temporary registries.conf:", err)
}
if err := registriesConf.Close(); err != nil {
log.Fatalln("could not close temporary registries.conf:", err)
}

runCmd := exec.Command("docker", strings.Split(fmt.Sprintf(`pull --platform linux/%v %v`, target.Architecture, target.OS), " ")...)
runCmd.Env = []string{"CONTAINERS_REGISTRIES_CONF=" + registriesConf.Name()}

if !*quietFlag {
log.Println(runCmd)
Expand Down

0 comments on commit dbd9060

Please sign in to comment.