Skip to content

Commit

Permalink
Install docker in Vagrant environment
Browse files Browse the repository at this point in the history
This allows for working with the Docker-based BATS tests

Signed-off-by: James Casey <james@chef.io>
  • Loading branch information
James Casey committed Sep 21, 2018
1 parent 3c468a4 commit 5982d00
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ Vagrant.configure("2") do |config|

config.vm.provision "file", source: "components/hab/install.sh", destination: "/tmp/install.sh"
config.vm.provision "shell", path: "support/linux/install_dev_0_ubuntu_latest.sh"
config.vm.provision "shell", path: "support/linux/install_dev_8_docker.sh"
config.vm.provision "shell", path: "support/linux/install_dev_9_linux.sh"
end
27 changes: 27 additions & 0 deletions support/linux/install_dev_8_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
set -eux

# Install Docker to run bats tests
# From: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository
#
sudo apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

sudo -E apt-get install -y --no-install-recommends \
docker-ce

# if running on a Vagrantbox, add the vagrant user
# as well as the current user
if getent passwd vagrant > /dev/null 2>&1; then
sudo -E usermod -aG docker vagrant
fi
sudo -E usermod -aG docker ${USER}

0 comments on commit 5982d00

Please sign in to comment.