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-get -y install apt-transport-https ca-certificates curl && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
service lxcfs stop && apt-get remove -y -q lxc-common lxcfs lxd lxd-client && \
apt-get update -q && \
apt-get install -y -q docker-ce && \
printf '{ "userns-remap" : "default" , "storage-driver" : "overlay2" }' > /etc/docker/daemon.json && \
systemctl restart docker.service
#!/bin/sh
#
# add's docker official ppa package source for Docker engine and install it
# does not include docker-compose or docker-machine
# run as root
#
# ensure we have tools to install
apt-get -y install \
apt-transport-https \
ca-certificates \
curl
# add official package repo key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add official package repo
# change stable on the last line to edge for beta-like monthly releases
# stable releases are quarterly
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# 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 docker community (free) edition
apt-get -y install docker-ce
#
# 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-ce=17.05.0* --allow-change-held-packages
# hold to that version
#apt-mark hold docker-ce
# remove hold later for upgrade
#apt-mark unhold docker-ce
# see what upgrade options exist
#apt-cache policy docker-ce
# 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
# this now uses the daemon.json method rather that the old way of modifying systemd
printf '{ "userns-remap" : "default" , "storage-driver" : "overlay2" }' > /etc/docker/daemon.json
systemctl restart docker.service

tsabat commented Oct 24, 2016

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

BretFisher commented Oct 28, 2016

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