I'm using Vagrant to create several Docker containers. Everything seems to work well except I can't control CPU and memory allocation to the containers. Below you can see a couple of failed attempts.
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.ssh.insert_key = false
  config.vm.provider "docker" do |d|
    d.build_dir = "."
    d.force_host_vm = false
    d.has_ssh = true
#    d.cpus = "2"           # works for vbox not docker
#    d.memory = "4096"      # same      
    d.create_args = [ "--privileged", "-v", "/sys/fs/cgroup:/sys/fs/cgroup:ro" ]
    d.customize ["modifyvm", :id, "--cpus", "2"]            # Also throws error
    d.customize ["modifyvm", :id, "--memory", "4096"]       # same
    d.remains_running = true
  end
  config.vm.define :c7301 do |c7301|
    c7301.vm.hostname = "c7301.ambari.apache.org"
    c7301.vm.network :private_network, ip: "192.168.73.101"
    c7301.vm.network "forwarded_port", guest:7180, host: 7180
  end
Any advice?
 
    