I try to use vagrant on my new Mac M1 and for that I try to replace the virtualbox provider (not availaible on mac m1) by docker.
I have create a docker file
# Docker image to use with Vagrant # Aims to be as similar to normal Vagrant usage as possible # Adds Puppet, SSH daemon, Systemd # Adapted from https://github.com/BashtonLtd/docker-vagrant-images/blob/master/ubuntu1404/Dockerfile FROM ubuntu:18.04 ENV container docker RUN apt-get update -y && apt-get dist-upgrade -y # Install system dependencies, you may not need all of these RUN apt-get install -y --no-install-recommends ssh sudo libffi-dev systemd openssh-client # Needed to run systemd # VOLUME [ "/sys/fs/cgroup" ] # Doesn't appear to be necessary? See comments RUN apt-get -y install puppet # Add vagrant user and key for SSH RUN useradd --create-home -s /bin/bash vagrant RUN echo -n 'vagrant:vagrant' | chpasswd RUN echo 'vagrant ALL = NOPASSWD: ALL' > /etc/sudoers.d/vagrant RUN chmod 440 /etc/sudoers.d/vagrant RUN mkdir -p /home/vagrant/.ssh RUN chmod 700 /home/vagrant/.ssh RUN echo "ssh-rsa AAA..Q==" > /home/vagrant/.ssh/authorized_keys RUN chmod 600 /home/vagrant/.ssh/authorized_keys RUN chown -R vagrant:vagrant /home/vagrant/.ssh RUN sed -i -e 's/Defaults.*requiretty/#&/' /etc/sudoers RUN sed -i -e 's/\(UsePAM \)yes/\1 no/' /etc/ssh/sshd_config # Start SSH RUN mkdir /var/run/sshd EXPOSE 22 RUN /usr/sbin/sshd # Start Systemd (systemctl) CMD ["/lib/systemd/systemd"]
and a vagrantfile
Vagrant.configure(2) do |config| # ... your existing config # Custom configuration for docker config.vm.provider "docker" do |docker, override| # docker doesnt use boxes override.vm.box = nil # this is where your Dockerfile lives docker.build_dir = "." # Make sure it sets up ssh with the Dockerfile # Vagrant is pretty dependent on ssh override.ssh.insert_key = true docker.has_ssh = true # Configure Docker to allow access to more resources docker.privileged = true end end
I try to launch vagrant with the command
vagrant up --provider=docker
but it fail
An active machine was found with a different provider. Vagrant currently allows each machine to be brought up with only a single provider at a time. A future version will remove this limitation. Until then, please destroy the existing machine to up with a new provider. Machine name: default Active provider: virtualbox Requested provider: docker
Does anyone can help me ?