@@ -194,12 +194,14 @@ class BaseRunConfiguration(CoreModel):
194194 ] = None
195195 python : Annotated [
196196 Optional [PythonVersion ],
197- Field (description = "The major version of Python. Mutually exclusive with `image`" ),
197+ Field (
198+ description = "The major version of Python. Mutually exclusive with `image` and `docker`"
199+ ),
198200 ] = None
199201 nvcc : Annotated [
200202 Optional [bool ],
201203 Field (
202- description = "Use image with NVIDIA CUDA Compiler (NVCC) included. Mutually exclusive with `image`"
204+ description = "Use image with NVIDIA CUDA Compiler (NVCC) included. Mutually exclusive with `image` and `docker` "
203205 ),
204206 ] = None
205207 single_branch : Annotated [
@@ -244,6 +246,12 @@ class BaseRunConfiguration(CoreModel):
244246 volumes : Annotated [
245247 List [Union [MountPoint , str ]], Field (description = "The volumes mount points" )
246248 ] = []
249+ docker : Annotated [
250+ Optional [bool ],
251+ Field (
252+ description = "Use Docker inside the container. Mutually exclusive with `image`, `python`, and `nvcc`. Overrides `privileged`"
253+ ),
254+ ] = None
247255 # deprecated since 0.18.31; task, service -- no effect; dev-environment -- executed right before `init`
248256 setup : CommandsList = []
249257
@@ -259,6 +267,18 @@ def convert_python(cls, v, values) -> Optional[PythonVersion]:
259267 return PythonVersion (v )
260268 return v
261269
270+ @validator ("docker" , pre = True , always = True )
271+ def _docker (cls , v , values ) -> Optional [bool ]:
272+ if v is True and values .get ("image" ):
273+ raise KeyError ("`image` and `docker` are mutually exclusive fields" )
274+ if v is True and values .get ("python" ):
275+ raise KeyError ("`python` and `docker` are mutually exclusive fields" )
276+ if v is True and values .get ("nvcc" ):
277+ raise KeyError ("`nvcc` and `docker` are mutually exclusive fields" )
278+ # Ideally, we'd like to also prohibit privileged=False when docker=True,
279+ # but it's not possible to do so without breaking backwards compatibility.
280+ return v
281+
262282 @validator ("volumes" , each_item = True )
263283 def convert_volumes (cls , v ) -> MountPoint :
264284 if isinstance (v , str ):
0 commit comments