How do I provision a Dockerfile from Vagrant

前端 未结 3 1322
Happy的楠姐
Happy的楠姐 2021-02-05 10:48

How can I start the provisioning of Docker via an external Dockerfile? My Vagrantfile looks like this at the moment

Vagrant.configure(\"2\") do |config|
  config         


        
3条回答
  •  猫巷女王i
    2021-02-05 11:34

    An option for the Docker provisioner to build images was added in v1.6.0. Download the latest version from the Vagrant website.

    Once you've done that, put a Dockerfile next to your Vagrantfile. Add this to your Vagrantfile:

    config.vm.provision "docker" do |d|
      d.build_image "/vagrant", args: "-t my-name/my-new-image"
      d.run "my-name/my-new-image"
    end
    

    Now your Docker image will be built and run with vagrant up.

提交回复
热议问题