Now exit root shell (just with `exit`), and try `lxc-console -n CONTAINERNAME`.
Now exit root shell (just with `exit`), and try `lxc-console -n CONTAINERNAME`.
You should be able to log in using the new username and password.
You should be able to log in using the new username and password.
(To exit lxc console, use Ctrl+A, Q)
(To exit lxc console, use Ctrl+A, Q).
### Alternatively: unprivileged LXC using LXD
### Alternatively: unprivileged LXC using LXD
@ -597,8 +611,32 @@ doas lxc exec test-alpine-container -- /bin/ash
```
```
Networking should work inside of container.
Networking should work inside of container.
#### OpenSSH
With password-based auth (not recommended): in container (from root, `lxc-attach`/`lxc exec`)
```
apk add openssh
rc-update add sshd
rc-service sshd start
```
Check IP of container with `ifconfig`, and then on host,
```
doas apk add openssh-client
ssh CONTAINER_IP
```
With keys-based auth: TODO
### Docker
### Docker
For container terminal apps to be usable:
```
doas apk add ncurses-terminfo
```
#### (inside LXC)
#### (inside LXC)
TODO once nesting in LXC works (reference: https://discuss.linuxcontainers.org/t/lxc-on-alpine-host-sys-fs-cgroup-is-not-mounted-into-unprivileged-alpine-guest/15026/1)
TODO once nesting in LXC works (reference: https://discuss.linuxcontainers.org/t/lxc-on-alpine-host-sys-fs-cgroup-is-not-mounted-into-unprivileged-alpine-guest/15026/1)
@ -611,11 +649,16 @@ doas apk add docker
doas rc-update docker start
doas rc-update docker start
doas docker run hello-world
doas docker run hello-world
```
```
in the guest.
For networked docker containers, `doas lxc config edit CONTAINERNAME`,
add `linux.kernel_modules: br_netfilter` to the `config:` section,
and restart container (`doas lxc restart CONTAINERNAME`).