@@ -20,6 +20,7 @@ import (
2020 "go.podman.io/common/pkg/sysinfo"
2121 "go.podman.io/podman/v6/pkg/util"
2222 . "go.podman.io/podman/v6/test/utils"
23+ "go.podman.io/storage/pkg/stringid"
2324)
2425
2526var _ = Describe ("Podman pod create" , func () {
@@ -175,8 +176,12 @@ var _ = Describe("Podman pod create", func() {
175176
176177 Describe ("podman create pod with --hosts-file" , func () {
177178 BeforeEach (func () {
178- imageHosts := filepath .Join (podmanTest .TempDir , "pause_hosts" )
179- err := os .WriteFile (imageHosts , []byte ("56.78.12.34 image.example.com" ), 0o755 )
179+ buildDir := filepath .Join (podmanTest .TempDir , "build" + stringid .GenerateRandomID ())
180+ err := os .Mkdir (buildDir , 0o755 )
181+ Expect (err ).ToNot (HaveOccurred ())
182+
183+ imageHosts := filepath .Join (buildDir , "pause_hosts" )
184+ err = os .WriteFile (imageHosts , []byte ("56.78.12.34 image.example.com" ), 0o755 )
180185 Expect (err ).ToNot (HaveOccurred ())
181186
182187 configHosts := filepath .Join (podmanTest .TempDir , "hosts" )
@@ -191,11 +196,16 @@ var _ = Describe("Podman pod create", func() {
191196 podmanTest .RestartRemoteService ()
192197 }
193198
194- dockerfile := strings .Join ([]string {
199+ containerfile := strings .Join ([]string {
195200 `FROM ` + INFRA_IMAGE ,
196201 `COPY pause_hosts /etc/hosts` ,
197202 }, "\n " )
198- podmanTest .BuildImage (dockerfile , "foobar.com/hosts_test_pause:latest" , "false" , "--no-hosts" )
203+
204+ containerFilePath := filepath .Join (buildDir , "Containerfile" )
205+ err = os .WriteFile (containerFilePath , []byte (containerfile ), 0o644 )
206+ Expect (err ).ToNot (HaveOccurred ())
207+
208+ podmanTest .PodmanExitCleanly ("build" , "-q" , "-t" , "foobar.com/hosts_test_pause:latest" , "--layers=false" , "--no-hosts" , buildDir )
199209 })
200210
201211 It ("--hosts-file=path" , func () {
0 commit comments