Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Install Docker PPA on Ubuntu 16.04
# NOT FOR SHELL SCRIPT, but rather just for quick copy paste
# this is a copy-paste version with defaults of the full shell script docker-xenial.sh which is below this one in gist.
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
mkdir -p /etc/apt/sources.list.d && \
echo deb https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list && \
service lxcfs stop && apt-get remove -y -q lxc-common lxcfs lxd lxd-client && \
apt-get update -q && apt-get upgrade -y -q && \
apt-get install -y -q docker-engine && \
mkdir -p /etc/systemd/system/docker.service.d && \
printf '[Service]\nExecStart=\nExecStart=/usr/bin/dockerd -H fd:// --userns-remap=default --storage-driver overlay2' > /etc/systemd/system/docker.service.d/docker.conf && \
systemctl daemon-reload && \
systemctl restart docker.service
#!/bin/sh
# add's docker official ppa package source for Docker engine
# does not include docker-compose or docker-machine
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
mkdir -p /etc/apt/sources.list.d
echo deb https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list
# Other Package Branches, experimental gives you extra features that may change in future
#echo deb https://apt.dockerproject.org/repo ubuntu-xenial testing > /etc/apt/sources.list.d/docker.list
# remove lxcfs, as we don't need it if we're doing docker
service lxcfs stop
apt-get remove -y -q lxc-common lxcfs lxd lxd-client
apt-get update -q
# install latest release (main branch) version of docker
apt-get install -y -q docker-engine
#
# FOR PRODUCTION, CONTROL VERSION MANUALLY
#
# install docker specific ver
# we allow held changes here in case we need to rerun, script will still work 2nd time
#apt-get install -y -q docker-engine=1.13.1* --allow-change-held-packages
# hold to that version
#apt-mark hold docker-engine
# remove hold later for upgrade
# apt-mark unhold docker-engine
# see what upgrade options exist
# apt-cache policy docker-engine
# edit dockerd startup to enable namespaces and ensure overlay2
# note namespace won't work in all scenerios, like --net=host,
# but its tighter security so it's recommended to try using first
mkdir -p /etc/systemd/system/docker.service.d
printf '[Service]\nExecStart=\nExecStart=/usr/bin/dockerd -H fd:// --userns-remap=default --storage-driver overlay2' > /etc/systemd/system/docker.service.d/docker.conf
systemctl daemon-reload
systemctl restart docker.service
tsabat commented Oct 24, 2016 edited

here's the output from /var/log/syslog

problem

Also, this results in a dollar-sign being added to the docker daemon args

oops

Owner

Fixed the $ issue by replacing echo with printf. I can't replicate the "unauthenticated packages" error on 16.04 with AWS user-data @tsabat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment