Git Product home page Git Product logo

vagrant-friendly-docker-ubuntu-18's Introduction

vagrant-friendly-docker-ubuntu-18

A vagrant-friendly Ubuntu 18.04 Docker build (this will upset the Docker blowhards - we violate Docker conventions on purpose)

Rationale

We don't want to use Docker in production, but we do like how much faster it is than VirtualBox and fully-virtualized environments.

We wanted to use Docker instead of VirtualBox for our Vagrant workflow, along with Ansible. So, we did a thing.

What's in the box

It's actually pretty simple.

This image installs python and ssh-server.

Things we do:

  • Insert Vagrant's default insecure key for the vagrant user

  • Set up reasonable SSH services and configurations

  • Use SystemD hack to expose SystemD upwards to Vagrant and the running Ansible system such that you can query running system services through Ansible's systemd/service modules

How do I use it

See our example Vagrantfile

ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'

Vagrant.configure("2") do |config|

## Configure Docker provider for all vms
    config.vm.provider "docker" do |d|
        # d.build_dir       = "./"
        # d.git_repo =
        d.image                     = 'armenr/ubuntu18.04-vagrant'
        d.pull                      = true
        d.has_ssh                   = true
        d.remains_running           = true
        # Use these implicit port mappings at your own risk for multi-machine
        # d.ports = [ "5044:5044" ]
    end

    ## Using vanilla vagrant ssh settings & keys
    config.ssh.username   = 'vagrant'
    config.vm.network :private_network, type: "dhcp", docker_network__internal: true

    # NOTE - for later: https://github.com/devopsgroup-io/vagrant-hostmanager
    # config.hostmanager.enabled           = true
    # config.hostmanager.manage_guest      = true
    # config.vm.provision :hostmanager

## Begin defining vms

    ## Sample docker1
    config.vm.define :machine1 do |machine1|
        machine1.vm.hostname = "machine1"
        machine1.vm.provider "docker" do |d, override|
          d.name = "machine1"
          d.ports = [ "5044:5044" ]
          d.link "machine2:machine2"
        end
    end

    ## Sample docker2
    config.vm.define :machine2 do |machine2|
      machine2.vm.hostname = "machine2"
      machine2.vm.provider "docker" do |d, override|
        d.name = "machine2"
        d.ports = [ "5000:5000" ]
      end
    end

## End all vms
end

vagrant-friendly-docker-ubuntu-18's People

Contributors

armenr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.