I want to run an Alpine Linux container using ChromeOS.
Procedure #
- Start the CROSH shell (ctrl-alt-t).
- Connect to the termina container:
vmc start termina - Add a new LXD remote image source:
lxc remote add canonical https://images.lxd.canonical.com --protocol=simplestreams - Launch a new Alpine container:
lxc launch canonical:alpine/edge my-alpine - Connect to the new container:
lxc exec my-alpine -- /bin/sh.
Comments #
Setup lxd for Remote Access #
1$ lxc config set core.https_address :8443
2$ lxc config set core.trust_password somepassword
Setup lxc on Penguin #
This allows lxc to be used in the default penguin container.
1$ sudo apt install lxd-client
2$ lxc remote add chromeos $(ip route show default | awk '{print $3}') --accept-certificate
3$ lxc remote set-default chromeos
Shared Storage #
Create a new storage volume and attach it to the container.
1$ lxc storage volume create default repos --type=filesystem # create a new storage volume
2$ lxc storage volume set default repos security.shifted=true # remap uids & gids for the volume
3$ lxc storage volume attach default repos alpine /home/jswank/repos # attach the storage volume to the container
Alpine / Cloud Init #
Copy a file from a container to the host #
1(termina) chronos@localhost ~ $ lxc file pull penguin/home/jswank/repos/prose/alpine-chromeos-files/my-user-data /tmp/my-user-data
Start a cloud init Alpine container #
1(termina) chronos@localhost ~ $ lxc launch canonical:alpine/3.20/cloud test-alpine --config=user.user-data="$(cat /tmp/my-user-data)"
2$ lxc config device add alpine-test repos disk pool=default source=repos path=/home/cli/repos
Connect to a running Alpine container #
1$ lxc exec test-alpine -- su - cli
References #
- https://discuss.linuxcontainers.org/t/using-lxd-on-your-chromebook/3823
- https://documentation.ubuntu.com/lxd/en/latest/howto/storage_volumes/
last updated: