Skip to content

Instantly share code, notes, and snippets.

@mlgrm
Last active February 27, 2019 11:18
Show Gist options
  • Save mlgrm/998daaabd270f421f464ff1999146162 to your computer and use it in GitHub Desktop.
Save mlgrm/998daaabd270f421f464ff1999146162 to your computer and use it in GitHub Desktop.
set up an lxc container running ubuntu 18.04 and docker.io on chromeos
#!/bin/bash
# usage:
# curl -sL bit.ly/mlgrm-docker | HOST_NAME=name bash
# all flags can be replaced by env vars with the usual keymapping
trap clean_up ERR SIGTERM SIGINT
clean_up () {
lxc rm --force $HOST_NAME
lxc profile delete $HOST_NAME
}
HOST_NAME=${HOST_NAME:-docker}
lxc launch ubuntu:18.04 $HOST_NAME
lxc profile cp default $HOST_NAME
lxc profile unset $HOST_NAME security.syscalls.blacklist
lxc profile apply $HOST_NAME $HOST_NAME
lxc restart $HOST_NAME
echo "until apt-get update && apt-get install -y docker.io; do sleep 3; done" |
lxc exec $HOST_NAME -- bash
lxc exec $HOST_NAME -- usermod -a -G docker ubuntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment