2

I am trying to use a Vagrant Docker provider running on VirtualBox with Windows host. But I can't get in because it's asking for an SMB username/password. I tried disabling synced folders with the following.

config.vm.synced_folder ".", "/vagrant", disabled: true

I also tried using type "virtualbox", which works fine when I use a VB provider with CentOS, but I think you need guest additions for that, and I get an error when I use the vagrant-vbguest plugin. It complains about a missing directory, which is probably something to do with the directory structure on the boot2docker image.

mkdir: can't create directory '/tmp/selfgz117312639': No such file or directory

Cannot create target directory /tmp/selfgz117312639

This is my configuration, which I've pieced together from a few sources. Note that the DockerHostVagrantfile is needed to get around a kernel panic.

# Dockerfile
FROM rockylinux/rockylinux:9.0.20220712 #phusion/baseimage
RUN rm -f /etc/service/sshd/down
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
RUN /usr/sbin/enable_insecure_key
# Vagrantfile
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
Vagrant.configure("2") do |config|
  config.vm.define "DockerTest"
  config.ssh.private_key_path = "insecure_key"
  config.vm.provider "docker" do |d|
    d.name = "DockerTest"
    d.build_dir = "."
    d.force_host_vm = true
    d.has_ssh = true
    d.remains_running = true
    d.cmd = ["/sbin/my_init", "--enable-insecure-key"]
    d.vagrant_machine = "default"
    d.vagrant_vagrantfile = "./DockerHostVagrantfile"
  end
end


# DockerHostVagrantfile
Vagrant.configure("2") do |config|
  config.vm.provision "docker"
  config.vm.define "default"
  config.vm.box = "hashicorp/boot2docker"
  config.vbguest.auto_update = false
  config.vm.synced_folder ".", "/vagrant", disabled: true#, type: "virtualbox"
  config.vm.network "private_network", ip: "192.168.1.2"
  config.vm.provider :virtualbox do |vb|
      vb.name = "default"
      vb.cpus = 2
      vb.memory = 2048
  end
end
Todd
  • 121

0 Answers0