Skip to content

A sample vagrant setup for escaping the clutches of Docker for Mac

Notifications You must be signed in to change notification settings

spookybando/docker-mac-vagrant

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker in Vagrant

D4M is slow. Primarily because of its osxfs/grpcfuse sharing filesystem. On the other hands Parallels has their own proprietary driver, and it works at almost native speeds.

Setting up

  1. Install and set up vagrant VM:
    brew install direnv
    brew tap hashicorp/tap
    brew install vagrant
    vagrant plugin install vagrant-parallels
    vagrant plugin install vagrant-env
    cp .env.dist .envrc
  2. Set your preferred shared folder in the .env file, for example SHARE_PATH="/Users/markomitranic/Sites/" Now reload the direnv with direnv allow.
  3. Thats it, start vagrant with vagrant up.
  4. Add the following to VScode Settings:
    "docker.explorerRefreshInterval": 10000,
    "docker.host": "ssh://vagrant@workbox",
  5. You can even set up a docker context. Works similarly to what you'd use docker-machine for:
    docker context create workbox --docker "host=ssh://vagrant@workbox"
    docker context use workbox

Usage

There are various ways to code in this setup. I have outlined my decisions in a thorough article.

Naked

You can just go oldschool and keep coding on your local machine. Use your editor of choice. All the files will be sync-ed over to the containers at nearly native speeds.

You will need however, to have the language you use installed on your machine, if you hope to have intellisense.

Remote Interpreter

A better (albeit weird at first) way would be to share the code from your machine to the Parallels VM. Start containers. Refer to Remote Interpreter section for directions on how to use the editors.

Container-first

Feeling adventurous? Don't use sharing at all. Provision the VM with your SSH key, and download your projects. Start containers. Refer to Remote Interpreter section for directions on how to use the editors.

Remote coding How-tos

I have written an extensive article on the topic, in short:

  • VSCode has a built in "Attach to remote Container" capability. It spawns a real editor and you work directly with the native interpreter within the container.
  • JetBrains "thick-ide" products like PHPStorm have a similar capability to be located on your host, but use a remote interpreter from within the container.

About

A sample vagrant setup for escaping the clutches of Docker for Mac

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%