Skip to content

Instantly share code, notes, and snippets.

@shearluck
Last active October 16, 2015 10:07
Show Gist options
  • Save shearluck/368d79cefda3c890055f to your computer and use it in GitHub Desktop.
Save shearluck/368d79cefda3c890055f to your computer and use it in GitHub Desktop.
Sample ansible playbook for managing docker container
# Run with:
# ansible-playbook docker-playbook.yml
- hosts: 127.0.0.1
sudo: yes # If in use, add parameter: --ask-sudo-pass
tasks:
- name: Install docker-py
pip: name=docker-py # Install dependency
- name: run docker app container
docker:
docker_api_version: 1.17 # Fix error when docker api and client version don't match
name: sample-app # This will be the docker container name
image: docker-image # Docker image name
net: host # Fix error invalid network mode default
state: started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment