Skip to content

Instantly share code, notes, and snippets.

@MrCoffey
Last active January 20, 2018 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrCoffey/9244523353398792f11df97cc2ec1516 to your computer and use it in GitHub Desktop.
Save MrCoffey/9244523353398792f11df97cc2ec1516 to your computer and use it in GitHub Desktop.
Dockerfile for containers configured to install k8s
#Source: https://github.com/kubernetes/kubernetes/issues/35712
FROM ubuntu
ENV container docker
RUN apt-get -y update
RUN apt-get update -qq && apt-get install -qqy \
apt-transport-https \
ca-certificates \
curl \
lxc \
vim \
iptables
RUN curl -sSL https://get.docker.com/ | sh
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME /sys/fs/cgroup
VOLUME /var/run/docker.sock
CMD /sbin/init
!# /bin/sh
echo "Updating Ubuntu..."
apt-get update -y
apt-get upgrade -y
systemctl start docker
echo "Install os requirements"
apt-get install -y \
curl \
apt-transport-https \
dialog \
python \
daemon
echo "Add Kubernetes repo..."
sh -c 'curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -'
sh -c 'echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list'
apt-get update -y
echo "Installing Kubernetes requirements..."
apt-get install -y \
kubelet
# This is temporary fix until new version will be released
sed -i 38,40d /var/lib/dpkg/info/kubelet.postinst
apt-get install -y \
kubernetes-cni \
kubectl \
kubeadm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment