#Issues with 'with_exec()' [Python SDK]

1 messages · Page 1 of 1 (latest)

dense timber
#

I'm trying to run a few commands while building my container.

# Tried this:
variant = await variant.with_exec(["ls", "-al"])
variant = await variant.with_exec(["pip", "install", "-r", "requirements.txt"])
            
# And also this:
variant = await variant.with_exec(args = ["bash", "-c", "ls", "-al"], skip_entrypoint = True)
variant = await variant.with_exec(args = ["pip", "install", "-r", "requirements.txt"], skip_entrypoint = True)

Both ways of coding this (whether I overwrite the entrypoint or not), give me the expected output in the console when I run dagger run python .....

However, even though I have two with_exec that get executed successfully one after the other (command 1 being ls ... and command 2 being pip install ...), the Dagger command then fails telling me that ls (the first command) is not found.

What is going on? I don't understand. ls is successful, then pip is successful but then Dagger says that ls can't be found?? 😕

#

Update: this has something to do with the loop I'm using for multi-platform variants.
I've reduce my build from 3 variants to 1, and then it builds successfully.
So variants 2 and 3 must be using a Container instance which isn't what I think it is

#

Nevermind me........ 🤦‍♂️
I added "windows/amd64" to the list of variants being built, and that's the one giving this error about ls not being found.
Kind of a bummer, I'll see what I can do

tough tapir
#

@dense timber anything we can do to help?

dense timber
#

Honestly, I'm not sure what I was expecting.

I think I got a bit carried by the 'run in any environment' and mistook it as if it could magically output a container for any platform. Obviously the two are very different.

I have only one (recently hired) developer who is on Windows. So I'm just getting started at building containers for that platform. My lack of experience on this topic is showing.

As of now, I was building for *nix systems (my targets being Ubuntu and Mac ARM, mostly) and I got used to write my scripts and Dockerfile in a POSIX-compliant manner, sticking to commands and flags that are widely available.

If you have guidance on how to get started with building for Windows, specifically with Dagger, that would help me. Otherwise I'll just read some Getting started on the topic of building for Windows

tough tapir