Install Docker compose on Vagrant

In this tutorial, How to install docker compose on Vagrant? Docker Compose is a tool for defining and running multi-container Docker applications. Docker the essential for DevOps Roles.

Step by step Install Docker compose on Vagrant

  • Launch CentOS 7 with Vagrant
  • Install Docker on CentOS 7
  • Install Docker compose on CentOS 7
  • Sharing directory with host OS and guest OS ( CentOS 7)


Vagrant must be installed. You can refer to Install Vagrant as below:

Directory Structure

The directory Structure looks something like as below

- share # Directory
- Vagrantfile

The content Vagrantfile file as below

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config| = "centos/7" :private_network, type: "dhcp", ip: ""
    config.vm.synced_folder "./share", "/home/vagrant/share", type: "rsync" :forwarded_port, host: 80, guest: 80
    config.vm.provision :shell, path: "./"

Install docker on Centos 7 ( guest )

Check the current release and if necessary, update it in the command below:

The content “” file as below

# SELinux Permissive
sudo setenforce 0
# set timezone JST
sudo timedatectl set-timezone Asia/Ho_Chi_Minh
sudo yum install -y epel-release
sudo yum install -y vim git
# install docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
sudo yum install -y yum-utils \
device-mapper-persistent-data \
sudo yum-config-manager \
--add-repo \
sudo yum install -y docker-ce
# install docker-compose
sudo mkdir -p /opt/bin/
sudo curl -L$(uname -s)-$(uname -m) > ./docker-compose
sudo mv docker-compose /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# vagrant user add docker group
sudo gpasswd -a vagrant docker
# docker running
sudo systemctl enable docker
sudo systemctl start docker

Execute vagrant command

$ cd /home/huupv/DockerHost
$ vagrant up && vagrant ssh


Through the article, You can “Install docker compose on Vagrant as above. I hope will this your helpful.

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

3 thoughts on “Install Docker compose on Vagrant

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.