#Is it possible to use local images?

1 messages · Page 1 of 1 (latest)

full acorn
#

I'd like to use a locally built image (not build using dagger) for dagger to start containers from. It's not published to a registry.

Using the dag.Container().From(image) doesn't quite work since it tries to download from docker hub.

If not it seems like I could import it as a OCI tar file in dagger as a workaround.

https://dagger.cloud/conor/traces/5e0c92bdc3cd6fec0be2620f01f3e1b5

ocean nimbus
ruby pumice
#

Hi @ocean nimbus , could you guide me to import an image tar ?

I have a Dockerfile that uses a base image that I have built locally and saved to a tar file. How could I use it as base image to build from the Dockerfile ?

full acorn
#

here is an example ```go
func (m *MyModule) LoadImage(
ctx context.Context,
imageTar *dagger.File,
) (*dagger.Container) {
return dag.Container().Import(imageTar)
}

#
dagger call load-image --image-tar path/to/tar/file
ocean nimbus
#

cc @ruby pumice

ruby pumice
#

Thank you guys. I tried that same code before asking, but while the import works fine, I could not reference the imported image when building from a Dockerfile. Not because the import didn't work, but because I don't know how the imported image is available to the dag.Container().Build method. I could not find in the documentation or examples if the imported image is accessible in a FROM statement in the Dockerfile.

ocean nimbus