Skip to content

Instantly share code, notes, and snippets.

@junaid18183
Created September 28, 2016 11:41
Show Gist options
  • Save junaid18183/d1d457dd100e8a98e3debc3c89a21945 to your computer and use it in GitHub Desktop.
Save junaid18183/d1d457dd100e8a98e3debc3c89a21945 to your computer and use it in GitHub Desktop.
This is the terraform template to use with docker provider, covers ports and volumes + tested on boo2docker + make sure you copy the certs to cert path
# Configure the Docker provider
provider "docker" {
host = "tcp://192.168.99.100:2376/"
cert_path = "/vagrant/docker-certs"
}
# Create a container
resource "docker_container" "dashing" {
image = "${docker_image.dashing.latest}"
name = "dashing"
count = 1
ports {
internal = 3030
external = 3030
}
volumes {
container_path = "/public"
read_only = false
host_path = "/c/Users/junedm/Docker_Shared_Folders/Dashing/public/"
#volume_name = "${docker_volume.dashing_public.name}"
}
volumes {
container_path = "/dashboards"
host_path = "/c/Users/junedm/Docker_Shared_Folders/Dashing/dashboards/"
read_only = false
#volume_name = "${docker_volume.dashing_dashboards.name}"
}
volumes {
container_path = "/jobs"
host_path = "/c/Users/junedm/Docker_Shared_Folders/Dashing/jobs/"
read_only = false
#volume_name = "${docker_volume.dashing_jobs.name}"
}
volumes {
container_path = "/widgets"
host_path = "/c/Users/junedm/Docker_Shared_Folders/Dashing/widgets/"
read_only = false
#volume_name = "${docker_volume.dashing_widgets.name}"
}
volumes {
container_path = "/assets"
host_path = "/c/Users/junedm/Docker_Shared_Folders/Dashing/assets/"
read_only = false
#volume_name = "${docker_volume.dashing_assets.name}"
}
volumes {
container_path = "/lib-dashing"
host_path = "/c/Users/junedm/Docker_Shared_Folders/Dashing/lib-dashing/"
read_only = false
#volume_name = "${docker_volume.dashing_lib.name}"
}
volumes {
container_path = "/config"
host_path = "/c/Users/junedm/Docker_Shared_Folders/Dashing/config/"
read_only = false
#volume_name = "${docker_volume.dashing_config.name}"
}
}
##########################################################################################
resource "docker_image" "dashing" {
name = "frvi/dashing"
keep_locally = 1
}
##########################################################################################
resource "docker_volume" "dashing_public" {
name = "dashing_public"
}
resource "docker_volume" "dashing_dashboards" {
name = "dashing_dashboards"
}
resource "docker_volume" "dashing_jobs" {
name = "dashing_jobs"
}
resource "docker_volume" "dashing_widgets" {
name = "dashing_widgets"
}
resource "docker_volume" "dashing_assets" {
name = "dashing_assets"
}
resource "docker_volume" "dashing_lib" {
name = "dashing_lib"
}
resource "docker_volume" "dashing_config" {
name = "dashing_config"
}
##########################################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment