Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker 1.10 user namespacing #32

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 1 addition & 2 deletions packer/scripts/install-buildkite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ priority=1
EOF

sudo yum -y install buildkite-agent
sudo usermod -a -G docker buildkite-agent

# https://github.com/buildkite/agent/issues/234
if [ -f /etc/init/buildkite-agent.conf ]; then
Expand All @@ -21,4 +20,4 @@ fi
# move custom hooks into place
chmod +x /tmp/conf/hooks/*
sudo cp -a /tmp/conf/hooks/* /etc/buildkite-agent/hooks
sudo chown -R buildkite-agent: /etc/buildkite-agent/hooks
sudo chown -R buildkite-agent: /etc/buildkite-agent/hooks
14 changes: 11 additions & 3 deletions packer/scripts/install-docker.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/bin/bash -eu
#!/bin/bash -eux

sudo yum update -yq
sudo yum install -yq docker
sudo usermod -a -G docker ec2-user
sudo usermod -a -G docker buildkite-agent

sudo cp /tmp/conf/docker.conf /etc/sysconfig/docker
sudo cp /tmp/conf/subuid /etc/subuid
sudo cp /tmp/conf/subgid /etc/subgid

# 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
sudo service docker start || ( cat /var/log/docker && false )
sudo docker info

# installs docker-compose
Expand All @@ -19,4 +27,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