I'm running Mac (linux/arm64/v8) and like to use GitHubs super-linter (ghcr.io/super-linter/super-linter:latestdocker.io/alpine:latest) in a dagger module, running "dag.container().from_("ghcr.io/super-linter/super-linter:latest")..." but get ge error: "! failed to resolve source metadata for ghcr.io/super-linter/super-linter:latest: no match for platform in manifest: not found". This is due to GitHub don't providing a image version for Mac. Using docker locally I'm able to just add the flag "--platform linux/amd64" and run it anyway... can i achive this in dagger or am I bound to the os version?
#Download and run different architecture of image??
1 messages · Page 1 of 1 (latest)
hey there! yes, you can do this. You'll notice the container method has a platform argument where you can specify which platform you want that container image to be pulled for. Hope this helps!
Cheers!
Thanks for quick reply but i can not get it to work. if a use it in before or after the .from() i get the same error on the "next" command. Eg. "dag.container().platform("linux/arm64").from_("ghcr.io/super-linter/super-linter:latest").with_exec("xyz").stdout()" error: Function execution error: 'coroutine' object has no attribute 'from_'
When trying the .platform() it returns the platform but how do i use it to set the image i like?
I think what @woeful edge meant is you can directly pass the plateform when instantiate a container:
dag.container(platform="linux/amd64").from_("ghcr.io/super-linter/super-linter:latest").with_exec("xyz").stdout()
could you try this and see if it's works ☝️
Thanks... then i get
Stderr:
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ Function execution error: Method dagger.client.gen.Client.container() │
│ parameter platform='linux/amd64' was expected to be of type dagger.Platform │
│ | None. │
╰──────────────────────────────────────────────────────────────────────────────╯
It looks like i want a typ dagger.Platform... don't know how to add that as input
sure 👍
You need to first import the type:
import dagger
from dagger import ... , Platform
Then create a new variable with the platform you want:
linux_amd64 = Platform("linux/amd64")
then you can use it:
dag.container(platform=platform).from_("ghcr.io/super-linter/super-linter:latest").with_exec("xyz").stdout()
I'm working on a mac arm and running the code above worked for me @left bough
Thanks @gaunt hornet work awesome 👍🏻
@gaunt hornet do we have this documented or should I add it to our docs backlog?
The way platform should be passed to container is documented in the Python ref documentation:
https://dagger-io.readthedocs.io/en/sdk-python-v0.11.1/client.html#dagger.Client.container
It would be neat to have more example/usecases in our docs I suppose.
I'd like the docs to make use cases first and the language an implementation detail. You have to dig into an SDK to learn what you can do with Dagger. That's counterintuitive