Skip to content

Commit

Permalink
Use latest docker packages
Browse files Browse the repository at this point in the history
  • Loading branch information
annawake committed Sep 20, 2015
1 parent 8a3457a commit 89b0511
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
23 changes: 12 additions & 11 deletions script/docker.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#!/bin/bash

SSH_USER=${SSH_USERNAME:-vagrant}
SSH_USERNAME=${SSH_USERNAME:-vagrant}

UBUNTU_MAJOR_VERSION=$(lsb_release -rs | cut -f1 -d .)

docker_package_install() {
# Add the Docker repository to your apt sources list.
echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
# Add the Docker repository GPG key
curl -s https://get.docker.io/gpg | apt-key add -

# Update your sources
apt-get update

# Get the latest docker package
curl -sSL https://get.docker.com/gpg | sudo apt-key add -

# Install Docker
apt-get install -y lxc-docker
curl -sSL https://get.docker.com/ | sh

# Enable memory and swap accounting
sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"/' /etc/default/grub
update-grub

# Docker package does not current configure daemon to start on boot
# for Ubuntu 15.04 and up
if [[ "${UBUNTU_MAJOR_VERSION}" -gt "14" ]]; then
sudo systemctl enable docker
fi

# reboot
echo "Rebooting the machine..."
reboot
Expand Down Expand Up @@ -72,10 +76,7 @@ give_docker_non_root_access() {

# Add the connected "${USER}" to the docker group.
gpasswd -a ${USER} docker
gpasswd -a ${SSH_USER} docker

# Restart the Docker daemon
#service docker restart
gpasswd -a ${SSH_USERNAME} docker
}

give_docker_non_root_access
Expand Down
10 changes: 10 additions & 0 deletions test/docker_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require_relative 'spec_helper'

describe 'docker' do
docker_string = command('ls /usr/bin/docker').stdout
if docker_string.include? '/usr/bin/docker' then
it 'should have docker installed' do
expect(command('docker run hello-world').exit_status).to eq(0)
end
end
end

0 comments on commit 89b0511

Please sign in to comment.