Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose pull instead of up #44

Open
lindsve opened this issue Feb 24, 2017 · 6 comments
Open

docker-compose pull instead of up #44

lindsve opened this issue Feb 24, 2017 · 6 comments
Labels

Comments

@lindsve
Copy link

lindsve commented Feb 24, 2017

Are there any way to configure this so it only pulls the images and not starting the containers?

@leighmcculloch
Copy link
Owner

Not at the moment, but we could support your workflow. How does pulling fit into your workflow?

In the meantime what you can do is reduce your config to something like:

config.vm.provision :docker
config.vm.provision :docker_compose

If you don't specify the .yml file it won't run up, it'll just install docker-compose.

Then you can add a shell provisioner that does the pull.

Example:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"

  config.vm.provision :docker
  config.vm.provision :docker_compose
  config.vm.provision :shell, inline: "cd /vagrant && docker-compose pull"
end

At the moment this plugin only runs up and not pull. It wouldn't be too difficult to add new boolean parameters that indicate which commands should be run, then you'd have full control over which ones run. I'll open a PR unless you want to take a stab at it? I'm thinking the config would look like this, with the new commands parameter:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"

  config.vm.provision :docker
  config.vm.provision :docker_compose,
    yml: "/vagrant/docker-compose.yml",
    options: "--x-networking",
    commands: { rm: true, build: true, pull: true, up: true },
    command_options: { rm: "", up: "-d --timeout 20"},
    run: "always"
end

@lindsve
Copy link
Author

lindsve commented Mar 1, 2017

Sorry for the delayed response,

tl;dr, just close this issue for now.

We was looking into having two VMs (A/B) in parallel where we wanted to make sure that we could provision A before stopping B and then start the containers in A. The runtime environment where we will deploy our VMs will most likely have an unstable Internet connection so we wanted to make sure that all images was properly pulled. We have looked more into this and we should be able to solve this with proper tagging of the images instead

@lindsve lindsve closed this as completed Mar 1, 2017
@weynhamz
Copy link

weynhamz commented Mar 5, 2017

I already have the images pre-built and pushed to a custom registry, and I don't want to rebuild the images again when up the vagrant, so a 'pull' command before the 'up' would be nice.

@leighmcculloch
Copy link
Owner

I'm going to reopen because I think we can make this a feature too.

@leighmcculloch leighmcculloch reopened this Mar 5, 2017
@gabz75
Copy link

gabz75 commented Jan 12, 2018

Any update on this? Is there an alternative solution while waiting for this feature?

EDIT:

A combo of https://github.com/leighmcculloch/vagrant-docker-login and
config.vm.provision :shell, inline: 'docker pull IMAGE_TAG', run: 'always' does the trick while waiting to leverage this feature

@leighmcculloch
Copy link
Owner

@gabz75 Would you (or anyone else) be up for taking a stab at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants