vagrant-wrapper.sh

When running any vagrant command, you normally need to be in a folder containing a Vagrantfile. In the case of ce-vm, it means you can only run vagrant commands from within the ce-vm folder of your project.

This script allows you to run vagrant commands from any directory within your project (provided the root is a git repository). To use it, add an alias of your choice (vg, vagrant, ce-vm, ...) to your .bashrc/.zshrc file.

alias vg="/bin/sh $HOME/.CodeEnigma/ce-vm/5.x/ce-vm-upstream/scripts/vagrant-wrapper.sh"

Note: You will need to have used ce-vm at least once before you can add the alias, else the script won't be present yet.

docker-sudo.sh

On Linux, the docker daemon is only accessible by the root user, meaning you are left with two choices:

  1. Running everything as root/sudo. This ends up being a mess of file permissions and ownership and is not really a practical option in a daily "local dev" environment.
  2. Adding your user to the "docker" group. This is convenient, and what most people end up doing, but poses a serious security issue.

To enforce Vagrant to use sudo for Docker commands, the easiest way is to wrap the docker executable. You can do this by adding a bash alias:

alias docker='sudo docker'

This however doesn't always work, as your bashrc won't always be sourced (eg in scripts, etc).

A simple and robust alternative is to take advantage of default $PATH precedence: 1. Check your 'docker' binary is at /usr/bin/docker with which docker. If it's located elsewhere, just alter the provided script with the right path. 2. Download the example script from https://raw.githubusercontent.com/codeenigma/ce-vm/5.x/scripts/docker-sudo.sh and rename it to /usr/local/bin/docker. 3. Make sure it is executable sudo chmod +x /usr/local/bin/docker