Class: DockerJail::Simple
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(image:, cmd_list:, user: nil, workdir: nil, cpus: nil, memory_mb: nil, pids_limit: nil, binds: nil, tmpfs: nil, **other_opts) ⇒ Simple
constructor
A new instance of Simple.
Methods inherited from Base
build_container, build_option, #delete, delete_all, #exit_code, #finished_at, get_all, #json, #oom_killed?, #run, #run_timeout, #started_at, #state, #timeout?
Constructor Details
#initialize(image:, cmd_list:, user: nil, workdir: nil, cpus: nil, memory_mb: nil, pids_limit: nil, binds: nil, tmpfs: nil, **other_opts) ⇒ Simple
Returns a new instance of Simple.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/docker-jail/simple.rb', line 15 def initialize(image:, cmd_list:, user: nil, workdir: nil, cpus: nil, memory_mb: nil, pids_limit: nil, binds: nil, tmpfs: nil, **other_opts) mem_size = memory_mb&.*(1024**2) other_host_opts = other_opts.delete(:HostConfig) host_opts = { CpusetCpus: cpus, Memory: mem_size, MemorySwap: mem_size, PidsLimit: pids_limit, Binds: binds, Tmpfs: tmpfs, }.compact.merge(other_host_opts || {}) opts = { Image: image, Cmd: cmd_list, User: user, WorkingDir: workdir, HostConfig: host_opts, }.compact.merge(other_opts) super(opts.merge(other_opts || {})) end |