docker-base

by freelyformd
3 deployments · 3 still active · last rev. 2 months ago

A simple box for docker hosts. Start with this stackscript, change boot to grub2 then let docker-machine do the rest

docker-machine create -d generic --generic-ip-address IP_ADDRESS --generic-ssh-key $HOME/.ssh/id_rsa --generic-ssh-user admin --generic-ssh-port 22 MACHINE_NAME

Compatible with: Ubuntu 16.04 LTS
Includes: lib-16
						#! /bin/bash
#
# Base server that sets a root SSH key and disables password auth. Used by me for Ansible-based deploys.
# <UDF name="HOSTNAME"          Label="Hostname" />
# <UDF name="USERNAME"          Label="Username" />
# <UDF name="PASSWORD"          Label="Password" />
# <UDF name="SSH_KEY"           Label="SSH Key" />
# <UDF name="FQDN"              Label="Domain Name">

source <ssinclude StackScriptID=46109>

IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')

apt-get update -o Acquire::ForceIPv4=true

goodstuff

# Basic Stuff

ssh_disable_root

ssh_disable_password

user_add_sudo "$USERNAME" "$PASSWORD"

user_add_pubkey "$USERNAME" "$SSH_KEY"

system_set_hostname "$HOSTNAME"

system_add_host_entry "$IPADDR" "$HOSTNAME"

system_add_host_entry "$IPADDR" "$FQDN"

service sshd restart

# Kernel Stuff

## Prevents debconf prompt
export DEBIAN_FRONTEND=noninteractive

apt-get install -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" linux-image-virtual grub2 linux-image-extra-$(uname -r) linux-image-extra-virtual apt-transport-https ca-certificates curl software-properties-common -y

update-grub

echo 'admin ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

groupadd docker

usermod -aG docker $USERNAME