mirror of
https://codeberg.org/scottslowe/learning-tools.git
synced 2026-03-11 09:04:37 +00:00
Add initial version of Vagrant-Docker files
Add Vagrantfiles and supporting documentation for running Docker under Vagrant.
This commit is contained in:
parent
e76b8b4e04
commit
e455630867
3 changed files with 75 additions and 0 deletions
14
vagrant-docker/README.md
Normal file
14
vagrant-docker/README.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Running Docker in Vagrant
|
||||
|
||||
These files were created to allow users to use Vagrant ([http://www.vagrantup.com](http://www.vagrantup.com)) to quickly and relatively easily launch one or more Docker ([http://www.docker.com](http://www.docker.com)) containers. The configuration was tested using Vagrant 1.7.2, VMware Fusion 6.0.5, and the Vagrant VMware plugin.
|
||||
|
||||
## Contents
|
||||
|
||||
* **README.md**: The file you're currently reading.
|
||||
|
||||
* **host/Vagrantfile**: This file is used by Vagrant to spin up a "host VM" for use with the Vagrant Docker provider. Edit this file to change the Vagrant box you'd like to use; by default, this Vagrantfile uses the "slowe/ubuntu-trusty-x64" box (built for the "vmware_desktop" provider).
|
||||
|
||||
* **Vagrantfile**: This file is used by Vagrant to spin up the Docker containers on the host VM created by `host/Vagrantfile`. Edit this file to change any of the properties of the Docker container you want created by Vagrant.
|
||||
|
||||
## Instructions
|
||||
|
||||
34
vagrant-docker/Vagrantfile
vendored
Normal file
34
vagrant-docker/Vagrantfile
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Specify Vagrant version and Vagrant API version
|
||||
Vagrant.require_version ">= 1.6.0"
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
|
||||
|
||||
# Create and configure the Docker container(s)
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
# Disable synced folders for the Docker container
|
||||
# (prevents an NFS error on "vagrant up")
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
|
||||
# Configure the Docker provider for Vagrant
|
||||
config.vm.provider "docker" do |docker|
|
||||
|
||||
# Define the location of the Vagrantfile for the host VM
|
||||
# Comment out this line to use default host VM that is
|
||||
# based on boot2docker
|
||||
docker.vagrant_vagrantfile = "host/Vagrantfile"
|
||||
|
||||
# Specify the Docker image to use
|
||||
docker.image = "nginx"
|
||||
|
||||
# Specify port mappings
|
||||
# If omitted, no ports are mapped!
|
||||
docker.ports = ['80:80', '443:443']
|
||||
|
||||
# Specify a friendly name for the Docker container
|
||||
docker.name = 'nginx-container'
|
||||
end
|
||||
end
|
||||
27
vagrant-docker/host/Vagrantfile
vendored
Normal file
27
vagrant-docker/host/Vagrantfile
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Specify Vagrant version and Vagrant API version
|
||||
Vagrant.require_version ">= 1.6.0"
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
# Create and configure the VM(s)
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
# Assign a friendly name to this host VM
|
||||
config.vm.hostname = "docker-host"
|
||||
|
||||
# Skip checking for an updated Vagrant box
|
||||
config.vm.box_check_update = false
|
||||
|
||||
# Always use Vagrant's default insecure key
|
||||
config.ssh.insert_key = false
|
||||
|
||||
# Spin up a "host box" for use with the Docker provider
|
||||
# and then provision it with Docker
|
||||
config.vm.box = "slowe/ubuntu-trusty-x64"
|
||||
config.vm.provision "docker"
|
||||
|
||||
# Disable synced folders (prevents an NFS error on "vagrant up")
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
end
|
||||
Loading…
Reference in a new issue