Tutorial on Running Workflow Through Docker¶
First, build and push your Docker image by following the instructions on creating a job to build and push image to ACR.
Docker¶
To run your container in Docker,
- Include the following configuration at the top of your
dagster_defs.pyfile. Make sure that "image" matches your image built in the previous step.
docker_config = ExecutionConfig(
executor=SelectorConfig(
class_name=docker_executor.__name__,
config={
# specify a default image
"image": image,
# set env vars here
# "env_vars": [f"DAGSTER_USER"],
"container_kwargs": {
"volumes": [
# bind the ~/.azure folder for optional cli login
f"/home/{user}/.azure:/root/.azure",
# bind current file so we don't have to rebuild
# the container image for workflow changes
f"{__file__}:{workdir}/{os.path.basename(__file__)}",
]
},
},
)
)
- Locate the
defs = dg.Definitions...object towards the bottom of thedagster_defs.pyfile. - Set the
default_configfor thedynamic_executorto bedocker_config.