Skip to content

Instantly share code, notes, and snippets.

@KrustyHack
Created January 29, 2015 17:07
Show Gist options
  • Save KrustyHack/cd214870a148a82f9141 to your computer and use it in GitHub Desktop.
Save KrustyHack/cd214870a148a82f9141 to your computer and use it in GitHub Desktop.
Saltstack docker sample
docker-registries:
https://my.regist.ry/v1/:
email: my@email.com
password: mypassword
username: myusername
# State file
{% set name = 'image' %}
{% set registryname = 'krustyhack' %}
{% set tag = 'latest' %}
{{ name }}-image:
docker.pulled:
- name: {{ registryname }}/{{ name }}
- tag: {{ tag }}
- force: False
{{ name }}-container:
docker.installed:
- name: {{ name }}
- hostname: {{ name }}
- image: {{ registryname }}/{{ name }}:{{ tag }}
- ports:
- "80/tcp"
- "443/tcp"
- volumes:
- /var/test:/home/test
- require_in: {{ name }}
- require:
- docker: {{ name }}-image
{{ name }}:
docker.running:
- container: {{ name }}
- binds:
/home/test/:
bind: /var/test/
ro: False
- port_bindings:
"80/tcp":
HostIp: "0.0.0.0"
HostPort: "80"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment