Skip to content

Commit d43be20

Browse files
committed
add README.md
1 parent 3599727 commit d43be20

File tree

3 files changed

+198
-0
lines changed

3 files changed

+198
-0
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# docker-tty
2+
I don't want to clutter my main system by installing many programs. **Flatpak**, **Snap** may be the solution. But I prefer to run the whole os with its own init system (a VM-like approach), but with chroot-like performance.
3+
4+
With Docker this can also be achieved, just like LXC. Docker is used here instead, simply because it is like a mandatory program for me these days.
5+
6+
I don't want to display GUI applications on VNC, or Xserver clients. Rather coexist with the host's tty.
7+
8+
In this case I use tty10 (Ctrl-Alt-F10).
9+
10+
Feel free to choose another number as long as it doesn't conflict with the host (most distros use 1 - 6, and 7 for Display Manager).
11+
12+
## Flavor
13+
* [debian-mate](debian-mate)
14+
* [debian-jwm](debian-jwm)

debian-jwm/README.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# debian-jwm
2+
Debian image with a minimalist Window Manager "JWM". The display will be on `tty10` (***Ctrl-Alt-F10***), coexisting with the host.
3+
4+
## Requirements
5+
Make sure `tty10` is empty / not in use. Check with **Ctrl-Alt-F10**, make sure you don't see getty's *login prompt* there.
6+
7+
It usually doesn't matter because most distros only use 1 - 6, and 7 for display managers (lightdm, sddm, etc).
8+
9+
## How-to
10+
**1. Installation (creating a container)**
11+
```
12+
docker create -it --name debian_jwm \
13+
--cap-add SYS_ADMIN --cap-add SYS_TTY_CONFIG --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
14+
--device /dev/tty --device /dev/tty0 --device /dev/tty7 --device /dev/tty10 \
15+
--device /dev/input --device /dev/psaux \
16+
--device /dev/bus/usb --device /dev/usb \
17+
--device /dev/snd \
18+
--device /dev/dri --device /dev/fb0 --device /dev/video0 --device /dev/vga_arbiter \
19+
-v /run/udev/control:/run/udev/control:ro -v /run/udev/data:/run/udev/data:ro \
20+
-v /etc/localtime:/etc/localtime:ro \
21+
nggit/debian-jwm:bullseye
22+
```
23+
At this point, you can add other volume bindings if you want to share data between the host and the container, using the ` -v` or ` -volume` flags. Because partitions like **/dev/sda1**, etc. are by default not exposed to containers for security reasons.
24+
25+
If the container cannot be created in the above way, for example there is a different device path on your device, you can customize it yourself. Or more simply use *privileged* mode to access all devices. But this also means ignoring the security aspect.
26+
```
27+
docker create -it --name debian_jwm \
28+
--privileged --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
29+
-v /run/udev/control:/run/udev/control:ro -v /run/udev/data:/run/udev/data:ro \
30+
-v /etc/localtime:/etc/localtime:ro \
31+
nggit/debian-jwm:bullseye
32+
```
33+
34+
**2. Run the container and check the logs**
35+
```
36+
docker start debian_jwm
37+
docker logs debian_jwm
38+
```
39+
You should see a line like the following at the end of the logs if the container is running properly:
40+
```
41+
Debian GNU/Linux 11 246eb7415c97 console
42+
```
43+
If you want to make the container always run automatically even if the host is restarted, you can change the restart policy on the container to *always* or *unless-stopped*:
44+
```
45+
docker update --restart unless-stopped debian_jwm
46+
```
47+
**3. Change the root password**
48+
```
49+
docker exec -it debian_jwm passwd
50+
```
51+
**4. Login**
52+
53+
You can login JWM in `tty10` (**Ctrl-Alt-F10**).
54+
55+
or console mode
56+
```
57+
docker attach debian_jwm
58+
```
59+
Press *Enter* or *Ctrl-C* if the login prompt has not appeared / closed log.
60+
61+
Done. For emergency you can enter using:
62+
```
63+
docker exec -it debian_jwm bash
64+
```
65+
## Login without root
66+
67+
**1. Create a group "mygroup"**
68+
```
69+
docker exec -it debian_jwm groupadd -g 1000 mygroup
70+
```
71+
**2. Create user "myuser"**
72+
```
73+
docker exec -it debian_jwm useradd -mu 1000 -g 1000 -G audio,video,input,tty,sudo,systemd-journal -s /bin/bash myuser
74+
```
75+
**3. Change the password of user "myuser"**
76+
```
77+
docker exec -it debian_jwm passwd myuser
78+
```
79+
Done. You can login with user "myuser" and your password.
80+
81+
## Installing the Display Manager in the container
82+
Display Managers like lightdm default to `tty7`, and when first running will display via `tty0`. This means it will follow wherever you currently are, e.g. `tty1`. You can get `tty1` back with **Ctrl-Alt-F1** if it gets overwritten by lightdm.
83+
84+
The main problem is `tty7`. Make sure your host is not using lightdm on that `tty7` as well.
85+
## Stopping and deleting the container
86+
```
87+
docker stop debian_jwm
88+
docker rm debian_jwm
89+
```
90+
91+
## License
92+
MIT

debian-mate/README.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# debian-mate
2+
Debian image with MATE Desktop Environment. The display will be on `tty10` (***Ctrl-Alt-F10***), coexisting with the host.
3+
4+
## Requirements
5+
Make sure `tty10` is empty / not in use. Check with **Ctrl-Alt-F10**, make sure you don't see getty's *login prompt* there.
6+
7+
It usually doesn't matter because most distros only use 1 - 6, and 7 for display managers (lightdm, sddm, etc).
8+
9+
## How-to
10+
**1. Installation (creating a container)**
11+
```
12+
docker create -it --name debian_mate \
13+
--cap-add SYS_ADMIN --cap-add SYS_TTY_CONFIG --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
14+
--device /dev/tty --device /dev/tty0 --device /dev/tty7 --device /dev/tty10 \
15+
--device /dev/input --device /dev/psaux \
16+
--device /dev/bus/usb --device /dev/usb \
17+
--device /dev/snd \
18+
--device /dev/dri --device /dev/fb0 --device /dev/video0 --device /dev/vga_arbiter \
19+
-v /run/udev/control:/run/udev/control:ro -v /run/udev/data:/run/udev/data:ro \
20+
-v /etc/localtime:/etc/localtime:ro \
21+
nggit/debian-mate:bullseye
22+
```
23+
At this point, you can add other volume bindings if you want to share data between the host and the container, using the ` -v` or ` -volume` flags. Because partitions like **/dev/sda1**, etc. are by default not exposed to containers for security reasons.
24+
25+
If the container cannot be created in the above way, for example there is a different device path on your device, you can customize it yourself. Or more simply use *privileged* mode to access all devices. But this also means ignoring the security aspect.
26+
```
27+
docker create -it --name debian_mate \
28+
--privileged --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
29+
-v /run/udev/control:/run/udev/control:ro -v /run/udev/data:/run/udev/data:ro \
30+
-v /etc/localtime:/etc/localtime:ro \
31+
nggit/debian-mate:bullseye
32+
```
33+
34+
**2. Run the container and check the logs**
35+
```
36+
docker start debian_mate
37+
docker logs debian_mate
38+
```
39+
You should see a line like the following at the end of the logs if the container is running properly:
40+
```
41+
Debian GNU/Linux 11 246eb7415c97 console
42+
```
43+
If you want to make the container always run automatically even if the host is restarted, you can change the restart policy on the container to *always* or *unless-stopped*:
44+
```
45+
docker update --restart unless-stopped debian_mate
46+
```
47+
**3. Change the root password**
48+
```
49+
docker exec -it debian_mate passwd
50+
```
51+
**4. Login**
52+
53+
You can login JWM in `tty10` (**Ctrl-Alt-F10**).
54+
55+
or console mode
56+
```
57+
docker attach debian_mate
58+
```
59+
Press *Enter* or *Ctrl-C* if the login prompt has not appeared / closed log.
60+
61+
Done. For emergency you can enter using:
62+
```
63+
docker exec -it debian_mate bash
64+
```
65+
## Login without root
66+
67+
**1. Create a group "mygroup"**
68+
```
69+
docker exec -it debian_mate groupadd -g 1000 mygroup
70+
```
71+
**2. Create user "myuser"**
72+
```
73+
docker exec -it debian_mate useradd -mu 1000 -g 1000 -G audio,video,input,tty,sudo,systemd-journal -s /bin/bash myuser
74+
```
75+
**3. Change the password of user "myuser"**
76+
```
77+
docker exec -it debian_mate passwd myuser
78+
```
79+
Done. You can login with user "myuser" and your password.
80+
81+
## Installing the Display Manager in the container
82+
Display Managers like lightdm default to `tty7`, and when first running will display via `tty0`. This means it will follow wherever you currently are, e.g. `tty1`. You can get `tty1` back with **Ctrl-Alt-F1** if it gets overwritten by lightdm.
83+
84+
The main problem is `tty7`. Make sure your host is not using lightdm on that `tty7` as well.
85+
## Stopping and deleting the container
86+
```
87+
docker stop debian_mate
88+
docker rm debian_mate
89+
```
90+
91+
## License
92+
MIT

0 commit comments

Comments
 (0)