Skip to content

Instantly share code, notes, and snippets.

@mc0e
Last active December 28, 2016 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mc0e/e7da8d567e76e7a46d3380c4eb0fde45 to your computer and use it in GitHub Desktop.
Save mc0e/e7da8d567e76e7a46d3380c4eb0fde45 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
# install docker
config.vm.provision "shell", inline: <<-SHELL
curl -fsSL https://get.docker.com/ | sh
systemctl enable docker.service
systemctl start docker
groupadd docker
sudo usermod -aG docker vagrant
SHELL
# install docker-compose
config.vm.provision "shell", inline: <<-SHELL
curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
SHELL
# configure and run the docker container
config.vm.provision "shell", inline: <<-SHELL
cat | tee docker-compose.yaml <<-'EOF'
version: '2'
services:
test:
image: openjdk:8-jre-alpine
command: tail -F /var/test/file.txt
restart: always
container_name: test
hostname: test
volumes:
- /var/run/centos:/var/test
EOF
mkdir /var/run/centos
docker-compose up -d
echo "This is new line" >> /var/run/centos/file.txt
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment