Last active
December 28, 2016 02:20
-
-
Save mc0e/e7da8d567e76e7a46d3380c4eb0fde45 to your computer and use it in GitHub Desktop.
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 : | |
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