0

I want to use security-opt option with docker-api gem .How can I implement it. I have found nothing about it in docker-api documentation. Somebody please help.

Neetesh
  • 71
  • 2
  • 6

1 Answers1

0

After a quick read of the documentation and this example, it looks like that library simply allows you to follow the JSON structure as is used by the Docker API

For the --security-opt option, this means that you should pass this option as SecurityOpt inside HostConfig. I'm not a Ruby code, but probably like this;

container = Docker::Container.create(
  "Cmd" => ["my", "command"],
  "Image" => "someimage"
  "HostConfig" => [
      "SecurityOpt" => ["apparmor:unconfined"]
  ]
  # Other configuration as needed.
)

Hope this helps

thaJeztah
  • 27,738
  • 9
  • 73
  • 92