Hello dagger team!
I'm not being able to mount a dir inside the container.
Code:
import sys
import uuid
import anyio
import dagger
from dagger import Config, Container
async def run():
dagger_config: Config = dagger.Config(log_output=sys.stdout)
async with dagger.Connection(dagger_config) as client:
container: Container = client.container().from_('python:3.10')\
.with_env_variable('BURST_CACHE', str(uuid.uuid4()))
container = container.with_workdir('/src')
container = container.with_mounted_directory('app', client.host().directory('app'))
container = container.with_exec(['ls', '-l', '.'])
container = container.with_exec(['ls', '-l', '/src/app'])
tar = await container.export('./export.tar')
anyio.run(run)
I load the tarball and run it doing:
docker run -it IMAGEID /bin/bash
and then:
root@bb2143b8bccd:/src# ls -l
total 0
Nothing in there...
The results from the with_exec ls -l are:
#2
#2 0.164 total 4
#2 0.164 drwxr-xr-x 1 root root 4096 Mar 29 18:00 app
#2 DONE 0.2s
#2
#2 0.173 total 4
#2 0.173 -rw-r--r-- 1 root root 0 Mar 29 16:41 __init__.py
#2 0.173 -rw-r--r-- 1 root root 262 Mar 29 16:18 main.py
#2 DONE 0.5s
It seems the folder and files are there. But then when the container runs it can't find the code...
Am I missing something here? And excuse me in advance if im missing some 101 stuff here...
Thanks again!