diff --git a/CHANGELOG.md b/CHANGELOG.md index 235f1ea7d..9037cfb65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ BUG FIXES: - guests/ubuntu: setting hostname fixed in 12.04 [GH-5937] - hosts/linux: NFS can be configured without `$TMP` set on the host [GH-5954] - hosts/linux: NFS will sudo copying back to `/etc/exports` [GH-5957] - - providers/virtulabox: remove UNC path conversion on Windows since it + - providers/docker: Add `pull` setting, default to false [GH-5932] + - providers/virtualbox: remove UNC path conversion on Windows since it caused mounting regressions [GH-5933] - provisioners/puppet: Windows Puppet 4 paths work correctly [GH-5967] - provisioners/puppet: Fix config merging errors [GH-5958] diff --git a/plugins/providers/docker/action/pull.rb b/plugins/providers/docker/action/pull.rb index 20d620792..be8875cf7 100644 --- a/plugins/providers/docker/action/pull.rb +++ b/plugins/providers/docker/action/pull.rb @@ -13,7 +13,7 @@ module VagrantPlugins @driver = @machine.provider.driver # Skip pulling if the image is built - return @app.call(env) if @env[:create_image] + return @app.call(env) if @env[:create_image] || !@provider_config.pull image = @provider_config.image env[:ui].output(I18n.t("docker_provider.pull", image: image)) diff --git a/plugins/providers/docker/config.rb b/plugins/providers/docker/config.rb index c06409a9f..ba042607a 100644 --- a/plugins/providers/docker/config.rb +++ b/plugins/providers/docker/config.rb @@ -61,6 +61,12 @@ module VagrantPlugins # @return [String] attr_accessor :name + # If true, the image will be pulled on every `up` and `reload` + # to ensure the latest image. + # + # @return [Bool] + attr_accessor :pull + # True if the docker container is meant to stay in the "running" # state (is a long running process). By default this is true. # @@ -140,6 +146,7 @@ module VagrantPlugins @image = UNSET_VALUE @name = UNSET_VALUE @links = [] + @pull = UNSET_VALUE @ports = UNSET_VALUE @privileged = UNSET_VALUE @remains_running = UNSET_VALUE @@ -199,6 +206,7 @@ module VagrantPlugins @has_ssh = false if @has_ssh == UNSET_VALUE @image = nil if @image == UNSET_VALUE @name = nil if @name == UNSET_VALUE + @pull = false if @pull == UNSET_VALUE @ports = [] if @ports == UNSET_VALUE @privileged = false if @privileged == UNSET_VALUE @remains_running = true if @remains_running == UNSET_VALUE diff --git a/website/docs/source/v2/docker/configuration.html.md b/website/docs/source/v2/docker/configuration.html.md index 6589ef887..f90bdde46 100644 --- a/website/docs/source/v2/docker/configuration.html.md +++ b/website/docs/source/v2/docker/configuration.html.md @@ -60,6 +60,9 @@ General settings: across all containers on the host VM. By default Vagrant will generate some random name. + * `pull` (bool) - If true, the image will be pulled on every `up` and + `reload`. Defaults to false. + * `ports` (array of strings) - Ports to expose from the container to the host. These should be in the format of `host:container`.