-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install docker in Vagrant environment
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
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
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
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} |