Skip to content

Commit

Permalink
providers/docker: pull setting, default false [hashicorpGH-5932]
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jul 15, 2015
1 parent f26293b commit bac5d03
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion plugins/providers/docker/action/pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def call(env)
@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))
Expand Down
8 changes: 8 additions & 0 deletions plugins/providers/docker/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ class Config < Vagrant.plugin("2", :config)
# @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.
#
Expand Down Expand Up @@ -140,6 +146,7 @@ def initialize
@image = UNSET_VALUE
@name = UNSET_VALUE
@links = []
@pull = UNSET_VALUE
@ports = UNSET_VALUE
@privileged = UNSET_VALUE
@remains_running = UNSET_VALUE
Expand Down Expand Up @@ -199,6 +206,7 @@ def finalize!
@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
Expand Down
3 changes: 3 additions & 0 deletions website/docs/source/v2/docker/configuration.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down

0 comments on commit bac5d03

Please sign in to comment.