diff --git a/README.md b/README.md index 4072975..8102463 100644 --- a/README.md +++ b/README.md @@ -1,120 +1,128 @@ -# lxc - -## Setup - -requires snap - -```bash -sudo apt install snap -``` - -```bash -sudo snap install lxd -sudo usermod -a -G lxd $(whoami) -``` - -Init - -Setup lxd - -```bash -sudo lxd init -``` - -## Containers - -### List - -```bash -lxc list -``` - -### Get Info - -```bash -lxc info containername -``` - -### Create - -```bash -lxc launch ubuntu containername -``` - -### move - -```bash -lxc mv ubuntu ubuntu1 -lxc mv ubuntu1 -s=poolname -``` - -### Stop - -```bash -lxc stop containername -``` - -Exec bash on container - -```bash -lxc exec $containername bash -``` - -### Exec multiple commands - -```bash -lxc exec "container name" -- bash -c "apt update -y && apt upgrade -y" -``` - -### delete a container - -```bash -lxc rm "container name" -#if force required -lxc rm "container name" --force -``` - -### Configuration - -Edit - -```bash -lxc config edit "container name" -``` - -Set value - -```bash -#Example -lxc config set "container name" "security.nesting" "true" - -``` - -### Profile Management - -```bash -lxc profile remove "container name" "profile name to remote" -lxc profile assign "container name" "profile name to assign" -``` - -## Profiles - -### macvlan only - -1) create copy from default - -```bash -lxc profile copy default eth0_macvlan -lxc profile edit eth0_macvlan -``` - -1) edit new profile - -```bash - -devices: - eth0: - nictype: macvlan - parent: eth0 # parent ethernet name - type: nic -``` +# lxc + +## Setup + +requires snap + +```bash +sudo apt install snap +``` + +```bash +sudo snap install lxd +sudo usermod -a -G lxd $(whoami) +``` + +Init + +Setup lxd + +```bash +sudo lxd init +``` + +## Containers + +### List + +```bash +lxc list +``` + +### Get Info + +```bash +lxc info containername +``` + +### Create + +```bash +lxc launch ubuntu containername +``` + +### move + +```bash +lxc mv ubuntu ubuntu1 +lxc mv ubuntu1 -s=poolname +``` + +### Stop + +```bash +lxc stop containername +``` + +Exec bash on container + +```bash +lxc exec $containername bash +``` + +### Exec multiple commands + +```bash +lxc exec "container name" -- bash -c "apt update -y && apt upgrade -y" +``` + +### delete a container + +```bash +lxc rm "container name" +#if force required +lxc rm "container name" --force +``` + +### Configuration + +Edit + +```bash +lxc config edit "container name" +``` + +Set value + +```bash +#Example +lxc config set "container name" "security.nesting" "true" + +``` + +### Profile Management + +```bash +lxc profile remove "container name" "profile name to remote" +lxc profile assign "container name" "profile name to assign" +``` + +## Profiles + +### macvlan only + +1) create copy from default + +```bash +lxc profile copy default eth0_macvlan +lxc profile edit eth0_macvlan +``` + +1) edit new profile + +```bash + +devices: + eth0: + nictype: macvlan + parent: eth0 # parent ethernet name + type: nic +``` + +## swap + +swap on lxc +limits.memory.swap: "false" + +swap on host +https://www.shellhacks.com/swappiness-in-linux-ubuntu-how-to-change/ diff --git a/documentation/running-docker.md b/documentation/running-docker.md index 55f2918..09fa88f 100644 --- a/documentation/running-docker.md +++ b/documentation/running-docker.md @@ -1,18 +1,18 @@ -# Running Docker - -on a lxc container - -## setup lxc container for docker - -### Config - -- security.nesting: "true" - -```bash -lxc config set $CONTAINER_NAME "security.nesting" "true" -#/scripts/lxc-config-docker-requirements.sh $CONTAINER_NAME -``` - -### setup ubuntu container - -Install docker with fuse fs [more information] (/kb/docker) +# Running Docker + +on a lxc container + +## setup lxc container for docker + +### Config + +- security.nesting: "true" + +```bash +lxc config set $CONTAINER_NAME "security.nesting" "true" +#/scripts/lxc-config-docker-requirements.sh $CONTAINER_NAME +``` + +### setup ubuntu container + +Install docker with fuse fs [more information] (/kb/docker)