vagrant-docker-provider icon indicating copy to clipboard operation
vagrant-docker-provider copied to clipboard

Vagrantfile doesn't work when using Docker as the provider

Open briansu2004 opened this issue 2 years ago • 0 comments

I tried your 2 Vagrant files but none of them work in my Windows if I use Docker as the provider.

No issues if I use VirtualBox.

Can you help?

1st file

Vagrant.configure("2") do |config|
  config.vm.hostname = "ubuntu"

  config.vm.provider :docker do |docker, override|
    override.vm.box = nil
    docker.image = "rofrano/vagrant-provider:ubuntu"
    docker.remains_running = true
    docker.has_ssh = true
    docker.privileged = true
    docker.volumes = ["/sys/fs/cgroup:/sys/fs/cgroup:rw"]
    docker.create_args = ["--cgroupns=host"]
    # Uncomment to force arm64 for testing images on Intel
    # docker.create_args = ["--platform=linux/arm64"]     
  end  
end

2nd file

https://github.com/rofrano/vagrant-docker-provider/blob/master/Vagrantfile

Error messages -

c:\>vagrant up 
Bringing machine 'default' up with 'docker' provider...
==> default: Creating and configuring docker networks...
==> default: Vagrant has noticed that the synced folder definitions have change
==> default: With Docker, these synced folder changes won't take effect until y
==> default: destroy the container and recreate it.
==> default: Enabling network interfaces...
==> default: Starting container...
==> default: Waiting for container to enter "running" state...
The container started either never left the "stopped" state or
very quickly reverted to the "stopped" state. This is usually
because the container didn't execute a command that kept it running,
and usually indicates a misconfiguration.

If you meant for this container to not remain running, please
set the Docker provider configuration "remains_running" to "false":

  config.vm.provider "docker" do |d|
    d.remains_running = false
  end

I tried to add d.remains_running = true but still the same issues.

Thanks.

briansu2004 avatar Apr 13 '23 20:04 briansu2004