#452  how to add docker command params in .yml
Closed
fly opened 2 years ago

like docker -e to pass my special environment params,how to set in .yml

Robin Shen commented 2 years ago
Do you mean the build spec? You may set environment variable directly in the command step, for instance, to have an environment variable with value set to build number:

buildNumber=@build_number@
fly commented 2 years ago

Yes, I mean build spec.

But I want to know how to modify docker init command, add optional params, like docker run --device=/dev/xx -v /data:/data, where can I set --device and -v in build spec?

Robin Shen commented 2 years ago
Mounting additional device or data volume is not a good idea, as it makes the job relying on external environment, and this can cause:
1. build may not be reproducible 
2. it is not difficult to scale to use other machines to run the job (agents for instance) for scaling up. 

It is suggested to build your custom data into an image, and use that image to run your job. 
Robin Shen commented 2 years ago
Typo:  it is DIFFICULT to scale to use other machines to run the job (agents for instance) for scaling up. 

On Nov 29, 2021, at 10:57 AM, OneDev <robin@onedev.io> wrote:

Mounting additional device or data volume is not a good idea, as it makes the job relying on external environment, and this can cause:
1. build may not be reproducible 
2. it is not difficult to scale to use other machines to run the job (agents for instance) for scaling up. 

It is suggested to build your custom data into an image, and use that image to run your job. 
Robin Shen commented 2 years ago

Also OneDev job tries to be transparent whether you are using a docker runner or a Kubernetes runner. So any local docker specific options will not be available in job definition.

fly commented 2 years ago

OK, get it.

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (3)
Reference
onedev/server#452
Please wait...
Page is in error, reload to recover