{"id":2309,"date":"2022-08-18T20:25:55","date_gmt":"2022-08-18T20:25:55","guid":{"rendered":"https:\/\/blog.samarthya.me\/wps\/?p=2309"},"modified":"2022-08-18T20:25:58","modified_gmt":"2022-08-18T20:25:58","slug":"vagrant-osx-m1","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2022\/08\/18\/vagrant-osx-m1\/","title":{"rendered":"Vagrant OSX &#8211; M1"},"content":{"rendered":"\n<p>Having just bought an M1 &#8211; MacBook Pro the issue are mounting. The premier challenge was to get my Vagrant boxes configured with provider <code>virtualbox<\/code> to run. <\/p>\n\n\n\n<p>Since VirtualBox clearly calls it out &#8220;no support&#8221;<\/p>\n\n\n\n<div class=\"wp-block-snow-monkey-blocks-balloon smb-balloon wp-block-snow-monkey-blocks-balloon-is-layout-constrained\"><div class=\"smb-balloon__person\"><div class=\"smb-balloon__figure\"><img decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/02\/Screenshot-2021-02-05-at-1.15.28-PM-150x150.png\" alt=\"\" class=\"wp-image-1315\"\/><\/div><div class=\"smb-balloon__name\">VBOX<\/div><\/div><div class=\"smb-balloon__body is-layout-constrained wp-block-balloon-is-layout-constrained\"><p>VirtualBox is a powerful x86 and AMD64\/Intel64\u00a0<a href=\"https:\/\/www.virtualbox.org\/wiki\/Virtualization\">virtualization<\/a>\u00a0product for enterprise as well as home use.<\/p><\/div><\/div>\n\n\n\n<p>The challenge was to find out what can work in the shortest time. I am keen to explore the <code>qemu<\/code> and <code>KVM's<\/code> but that is for another day as Docker seems to be the convenient solution for me.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-luminous-vivid-orange-background-color has-text-color has-background\"><code>> vagrant version\nInstalled Version: 2.3.0\nLatest Version: 2.3.0\n \nYou're running an up-to-date version of Vagrant!<\/code><\/pre>\n\n\n\n<p>Let&#8217;s create our first working version before targeting complex <code>Vagrantfile's<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-luminous-vivid-orange-background-color has-text-color has-background\"><code>> vagrant init \nA `Vagrantfile` has been placed in this directory. You are now\nready to `vagrant up` your first virtual environment! Please read\nthe comments in the Vagrantfile as well as documentation on\n`vagrantup.com` for more information on using Vagrant.<\/code><\/pre>\n\n\n\n<p>The command above generates a template Vagrantfile that I will use to sequentially edit and get a centos machine up and running.<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-pale-cyan-blue-background-color has-text-color has-background\"><code># -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n# All Vagrant configuration is done below. The \"2\" in Vagrant.configure\n# configures the configuration version (we support older styles for\n# backwards compatibility). Please don't change it unless you know what\n# you're doing.\nVagrant.configure(\"2\") do |config|\n  # The most common configuration options are documented and commented below.\n  # For a complete reference, please see the online documentation at\n  # https:\/\/docs.vagrantup.com.\n\n  # Every Vagrant development environment requires a box. You can search for\n  # boxes at https:\/\/vagrantcloud.com\/search.\n  config.vm.box = \"base\"\n\n  # Disable automatic box update checking. If you disable this, then\n  # boxes will only be checked for updates when the user runs\n  # `vagrant box outdated`. This is not recommended.\n  # config.vm.box_check_update = false\n\n  # Create a forwarded port mapping which allows access to a specific port\n  # within the machine from a port on the host machine. In the example below,\n  # accessing \"localhost:8080\" will access port 80 on the guest machine.\n  # NOTE: This will enable public access to the opened port\n  # config.vm.network \"forwarded_port\", guest: 80, host: 8080\n\n  # Create a forwarded port mapping which allows access to a specific port\n  # within the machine from a port on the host machine and only allow access\n  # via 127.0.0.1 to disable public access\n  # config.vm.network \"forwarded_port\", guest: 80, host: 8080, host_ip: \"127.0.0.1\"\n\n  # Create a private network, which allows host-only access to the machine\n  # using a specific IP.\n  # config.vm.network \"private_network\", ip: \"192.168.33.10\"\n\n  # Create a public network, which generally matched to bridged network.\n  # Bridged networks make the machine appear as another physical device on\n  # your network.\n  # config.vm.network \"public_network\"\n\n  # Share an additional folder to the guest VM. The first argument is\n  # the path on the host to the actual folder. The second argument is\n  # the path on the guest to mount the folder. And the optional third\n  # argument is a set of non-required options.\n  # config.vm.synced_folder \"..\/data\", \"\/vagrant_data\"\n\n  # Provider-specific configuration so you can fine-tune various\n  # backing providers for Vagrant. These expose provider-specific options.\n  # Example for VirtualBox:\n  #\n  # config.vm.provider \"virtualbox\" do |vb|\n  #   # Display the VirtualBox GUI when booting the machine\n  #   vb.gui = true\n  #\n  #   # Customize the amount of memory on the VM:\n  #   vb.memory = \"1024\"\n  # end\n  #\n  # View the documentation for the provider you are using for more\n  # information on available options.\n\n  # Enable provisioning with a shell script. Additional provisioners such as\n  # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the\n  # documentation for more information about their specific syntax and use.\n  # config.vm.provision \"shell\", inline: &lt;&lt;-SHELL\n  #   apt-get update\n  #   apt-get install -y apache2\n  # SHELL\nend<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-pullquote has-black-color has-light-green-cyan-background-color has-text-color has-background\" style=\"font-style:normal;font-weight:400\"><blockquote><p><a href=\"https:\/\/www.vagrantup.com\/docs\/providers\/docker\/basics\" data-type=\"URL\" data-id=\"https:\/\/www.vagrantup.com\/docs\/providers\/docker\/basics\" target=\"_blank\" rel=\"noreferrer noopener\">Official Vagrant Documentation<\/a><\/p><cite>https:\/\/www.vagrantup.com\/docs\/providers\/docker\/basics<\/cite><\/blockquote><\/figure>\n\n\n\n<p class=\"has-small-font-size\"><code>Docker<\/code> provider behaves like just any other provider, but in comparison to Virtualbox it has specific options like <code>config.vm.box<\/code> that do NOT WORK.<\/p>\n\n\n\n<p>Let&#8217;s add first box for docker to run<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code>config.vm.provider \"docker\" do |d|\n    d.image = \"centos:latest\"\nend<\/code><\/pre>\n\n\n\n<p>For my setup I get the following error.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vagrant up --provider=docker\nBringing machine 'default' up with 'docker' provider...\n==> default: Creating and configuring docker networks...\n==> default: Creating the container...\n    default:   Name: qemu-test_default_1660850922\n    default:  Image: centos:latest\n    default: Volume: \/Users\/samarthya\/sourcebox\/github.com\/qemu-test:\/vagrant\nA Docker command executed by Vagrant didn't complete successfully!\nThe command run along with the output from the command is shown\nbelow.\n\nCommand: &#91;\"docker\", \"run\", \"--name\", \"qemu-test_default_1660850922\", \"-d\", \"-v\", \"\/Users\/samarthya\/sourcebox\/github.com\/qemu-test:\/vagrant\", \"centos7:latest\", {:notify=>&#91;:stdout, :stderr]}]\n\nStderr: Unable to find image 'centos:latest' locally\ndocker: Error response from daemon: pull access denied for centos7, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.\nSee 'docker run --help'.\n\n\nStdout:<\/code><\/pre>\n\n\n\n<p>Once you login <code>docker login<\/code> it should be able to pull the image (can be confirmed with <code>docker images<\/code> command)<\/p>\n\n\n\n<p>The error I am stuck at is <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>==> default: Starting container...\nGuest-specific operations were attempted on a machine that is not\nready for guest communication. This should not happen and a bug\nshould be reported.<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Having just bought an M1 &#8211; MacBook Pro the issue are mounting. The premier challenge was to get my Vagrant boxes configured with provider virtualbox to run. Since VirtualBox clearly calls it out &#8220;no support&#8221; VBOX VirtualBox is a powerful x86 and AMD64\/Intel64\u00a0virtualization\u00a0product for enterprise as well as home use. The challenge was to find [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1428,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2309","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-technical","post_format-post-format-image"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=2309"}],"version-history":[{"count":3,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2309\/revisions"}],"predecessor-version":[{"id":2312,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2309\/revisions\/2312"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/1428"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=2309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=2309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=2309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}