Skip to content

Commit

Permalink
Use docker 1.10 user namespacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Scarr committed Mar 17, 2016
1 parent f95ffe0 commit 700da17
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packer/buildkite-ami.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
},
{
"type": "shell",
"script": "scripts/install-docker.sh"
"script": "scripts/install-buildkite.sh"
},
{
"type": "shell",
"script": "scripts/install-buildkite.sh"
"script": "scripts/install-docker.sh"
}
]
}
2 changes: 1 addition & 1 deletion packer/conf/docker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# running containers. The default value of 1048576 mirrors the value
# used by the systemd service unit.
DAEMON_MAXFILES=1048576
OPTIONS="--default-ulimit nofile=1024:4096 -s overlay"
OPTIONS="--default-ulimit nofile=1024:4096 -s overlay --userns-remap=buildkite-agent"
1 change: 1 addition & 0 deletions packer/conf/subgid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
buildkite-agent:496:65536
1 change: 1 addition & 0 deletions packer/conf/subuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
buildkite-agent:498:65536
12 changes: 9 additions & 3 deletions packer/scripts/install-docker.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/bin/bash -eu
#!/bin/bash -eux

sudo yum update -yq
sudo yum install -yq docker
sudo usermod -a -G docker ec2-user
sudo cp /tmp/conf/docker.conf /etc/sysconfig/docker
sudo cp /tmp/conf/subuid /etc/subuid
sudo cp /tmp/conf/subgid /etc/subgid

sudo service docker start
# Overwrite the yum packaged docker with the latest
sudo wget https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 -O /usr/bin/docker
sudo chmod +x /usr/bin/docker

sudo service docker start || ( cat /var/log/docker && false )
sudo docker info

# installs docker-compose
Expand All @@ -19,4 +25,4 @@ sudo chmod +x /etc/cron.hourly/docker-gc

# install jq
sudo curl -o /usr/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
sudo chmod +x /usr/bin/jq
sudo chmod +x /usr/bin/jq

0 comments on commit 700da17

Please sign in to comment.