vagrant up
vagrant ssh
sudo -i
docker -irt --name CONTAINER_NAME centos:centos6.6 bash
ansible-playbook -i hosts playbook.yml
docker commit $(docker ps -aqf "name=CONTAINER_NAME") CONTAINER_NAME:CONTAINER_VERSION
Created
April 21, 2016 23:27
-
-
Save index0h/f76264f78f67bcb3c31d9431fdbe1d09 to your computer and use it in GitHub Desktop.
ansible + docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' | |
[dockerrepo] | |
name=Docker Repository | |
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/ | |
enabled=1 | |
gpgcheck=1 | |
gpgkey=https://yum.dockerproject.org/gpg | |
EOF | |
sudo yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
sudo yum update -y | |
sudo yum install -y ansible docker-engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HOST_NAME] | |
DOCKER_CONTAINER_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: HOST_NAME | |
connection: docker | |
tasks: | |
- name: repo | |
yum: name=http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm state=present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = '2' | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
if Vagrant.has_plugin?('vagrant-vbguest') then | |
config.vbguest.auto_update = false | |
end | |
config.ssh.forward_agent = true | |
config.vm.box = 'puppetlabs/centos-7.2-64-nocm' | |
config.vm.hostname = 'docker-test' | |
config.vm.network 'private_network', ip: '192.168.100.150' | |
config.vm.provider 'virtualbox' do |vb| | |
vb.name = 'docker-test' | |
vb.customize [ | |
'modifyvm', :id, | |
'--memory', '2048', | |
'--ioapic', 'on', | |
'--natdnshostresolver1', 'on', | |
'--cpus', 2, | |
] | |
end | |
config.vm.provision :shell, path: 'ansible.sh' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment