Skip to content
New issue

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

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

Already on GitHub? # to your account

docker-compose V2? #65

Open
dmt0 opened this issue Sep 21, 2022 · 3 comments
Open

docker-compose V2? #65

dmt0 opened this issue Sep 21, 2022 · 3 comments

Comments

@dmt0
Copy link

dmt0 commented Sep 21, 2022

This doesn't work with V2 any more. The download URL has changed, so it simply can't pull it.

/Users/user/.vagrant.d/gems/2.7.6/gems/vagrant-docker-compose-1.5.1/lib/vagrant-docker-compose/installer.rb:55:in `fetch_file': 
Error: unable to download docker-compose: https://github.com/docker/compose/releases/download/2.11.0/docker-compose-Linux-x86_64 (RuntimeError)

With v2 the URL is https://github.com/docker/compose/releases/download/v2.11.0/docker-compose-Linux-x86_64 (there's a v in the version. There are probably other issues.

If this project is dead, what's the standard way of provisioning docker compose these days?

@EricKrg
Copy link

EricKrg commented Nov 11, 2022

@dmt0
I stumbled across the same problem you described here and i figured out a workaround with only using tools provided by vagrant:

Vagrant.configure("2") do |config|
    config.vm.define "ubuntu" do |ubuntu|
        ubuntu.vm.box = "bento/ubuntu-18.04"
        config.vm.provider "virtualbox" do |vb|
            vb.memory = "4096"
            vb.cpus = "1"
          end

        config.vm.synced_folder "./vagrant_data", "/vagrant", SharedFoldersEnableSymlinksCreate: false

        config.vm.provision "docker-compose-setup", type: "shell", preserve_order: true, path: "./vagrant_data/docker/install.sh"
        config.vm.provision :docker
        config.vm.provision "docker-compose-run", type: "shell",preserve_order: true, :run => 'always', path: "./vagrant_data/docker/run.sh"

        ubuntu.trigger.before :destroy, :halt do |trigger|
            trigger.info = "Stopping container..."
            trigger.run_remote = {inline: "cd /vagrant/docker && docker-compose stop"}
        end
    end
end

the config above should do the same as the plugin, at least it works for me. the install script installs the latest docker-compose version and the run scripts starts the containers on each vagrant up. The trigger ensures the correct stopping of the container.

to fix this problem in the plugin, it is probably enough to updated the value of @compose_version in the config.rb based on its value. But i am not very proficient in ruby and have no dev. env for ruby set up.

@evan108108
Copy link

@EricKrg Any chance you might share your "./vagrant_data/docker/run.sh" & "./vagrant_data/docker/run.sh" scripts. Would be helpful. Thanks!

@EricKrg
Copy link

EricKrg commented Jan 31, 2023

@evan108108 sure, https://github.com/EricKrg/vagrant-docker-compose-template/blob/main/vagrant_data/docker/run.sh i made a template project for this.

There is actually not happening a lot in the run.sh, but you might want to update the install.sh with a current version of docker -compose.

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

No branches or pull requests

3 participants