Skip to content

Commit d360a26

Browse files
committed
options
1 parent 8b7e6d4 commit d360a26

1 file changed

Lines changed: 86 additions & 1 deletion

File tree

lib/services.js

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ module.exports = async function (docker, projectName, recipe, output) {
9393
}
9494

9595
if (service.name !== undefined) {
96-
opts.Name = serviceName;
96+
opts.Name = service.container_name || serviceName;
97+
}
98+
if (service.domainname !== undefined) {
99+
opts.Domainname = service.domainname;
100+
}
101+
if (service.hostname !== undefined) {
102+
opts.Hostname = service.hostname;
103+
}
104+
if (service.mac_address !== undefined) {
105+
opts.MacAddress = service.mac_address;
97106
}
98107
try {
99108
var container = await docker.createContainer(opts);
@@ -146,6 +155,82 @@ var buildHostConfig = function (service, recipe) {
146155
output['PortBindings'] = ports;
147156
}
148157

158+
if (service.cpu_count !== undefined) {
159+
opts.CpuCount = service.cpu_count;
160+
}
161+
if (service.cpu_percent !== undefined) {
162+
opts.CpuPercent = service.cpu_percent;
163+
}
164+
if (service.cpu_shares !== undefined) {
165+
opts.CpuShares = service.cpu_shares;
166+
}
167+
if (service.cpu_period !== undefined) {
168+
opts.CpuPeriod = service.cpu_period;
169+
}
170+
if (service.cpu_quota !== undefined) {
171+
opts.CpuQuota = service.cpu_quota;
172+
}
173+
if (service.cpu_rt_runtime !== undefined) {
174+
opts.CpuRealtimeRuntime = service.cpu_rt_runtime;
175+
}
176+
if (service.cpu_rt_period !== undefined) {
177+
opts.CpuRealtimePeriod = service.cpu_rt_period;
178+
}
179+
if (service.cpuset !== undefined) {
180+
opts.CpusetCpus = service.cpuset;
181+
}
182+
if (service.cap_add !== undefined) {
183+
opts.CapAdd = service.cap_add;
184+
}
185+
if (service.cap_drop !== undefined) {
186+
opts.CapDrop = service.cap_drop;
187+
}
188+
if (service.cgroup_parent !== undefined) {
189+
opts.CgroupParent = service.cgroup_parent;
190+
}
191+
if (service.device_cgroup_rules !== undefined) {
192+
opts.DeviceCgroupRules = service.device_cgroup_rules;
193+
}
194+
if (service.dns !== undefined) {
195+
opts.Dns = service.dns;
196+
}
197+
if (service.dns_opt !== undefined) {
198+
opts.DnsOptions = service.dns_opt;
199+
}
200+
if (service.dns_search !== undefined) {
201+
opts.DnsSearch = service.dns_search;
202+
}
203+
if (service.extra_hosts !== undefined) {
204+
opts.ExtraHosts = service.extra_hosts;
205+
}
206+
if (service.group_add !== undefined) {
207+
opts.GroupAdd = service.group_add;
208+
}
209+
if (service.init !== undefined) {
210+
opts.Init = service.init;
211+
}
212+
if (service.ipc !== undefined) {
213+
opts.IpcMode = service.ipc;
214+
}
215+
if (service.isolation !== undefined) {
216+
opts.Isolation = service.isolation;
217+
}
218+
if (service.mem_swappiness !== undefined) {
219+
opts.MemorySwappiness = service.mem_swappiness;
220+
}
221+
if (service.oom_kill_disable !== undefined) {
222+
opts.OomKillDisable = service.oom_kill_disable;
223+
}
224+
if (service.oom_score_adj !== undefined) {
225+
opts.OomScoreAdj = service.oom_score_adj;
226+
}
227+
if (service.pid !== undefined) {
228+
opts.PidMode = service.pid;
229+
}
230+
if (service.pids_limit !== undefined) {
231+
opts.PidsLimit = service.pids_limit;
232+
}
233+
149234
return output;
150235
}
151236

0 commit comments

Comments
 (0)