Skip to content

Commit dbb6f6e

Browse files
authored
Added edit /etc/subgid section (#199)
1 parent 533fb22 commit dbb6f6e

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

sites/cheerpx/src/content/docs/11-guides/custom-images.mdx

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ buildah build -f Dockerfile --platform linux/i386 -t cheerpximage
2929

3030
## 3. Create a container from the Docker Image
3131

32-
Now, create a container from the image using `podman`. Ensure the image name matches the on you built in the previous step.
32+
Now, create a container from the image using `podman`. Ensure the image name matches the one you built in the previous step.
3333

3434
```bash
3535
podman create --name cheerpxcontainer cheerpximage
@@ -62,7 +62,7 @@ podman unshare mkfs.ext2 -b 4096 -d cheerpXFS/ cheerpXImage.ext2 600M
6262

6363
## 6. Clean up unused resources
6464

65-
After creating your `ext2` image, it's a good practice to clean up unused resources to free up space:
65+
After creating your `ext2` image, it's good practice to clean up unused resources to free up space:
6666

6767
Remove the container:
6868

@@ -81,3 +81,49 @@ Remove temporary directories:
8181
```bash
8282
rm -rf cheerpXFS
8383
```
84+
85+
## Optional: edit `/etc/subgid` (for the host user)
86+
87+
The `/etc/subgid` file defines the ranges of subordinate group IDs allocated to specific user accounts on the host for managing user namespaces in containers. This step is **optional** and not necessary for most use cases. However, you may choose to configure it if you encounter namespace-related conflicts.
88+
89+
### 1. Identify your host user
90+
91+
Run the following command to determine the host user running container commands:
92+
93+
```bash
94+
whoami
95+
```
96+
97+
### 2. Check `/etc/subgid` for your user
98+
99+
Open `/etc/subgid` and look for an entry matching your user:
100+
101+
```bash
102+
sudo nano /etc/subgid
103+
```
104+
105+
The file should contain lines in the format:
106+
107+
```
108+
<username>:<start_id>:<count>
109+
```
110+
111+
For example, for the user `johndoe`:
112+
113+
```
114+
johndoe:100000:65536
115+
```
116+
117+
### 3. Modify the file
118+
119+
If you need to change the `subgid` range for the host user, modify the `start_id` and/or `count` as needed. For example, if you want to assign a new range starting at 200000 with a count of 65536, you would change it to:
120+
121+
```
122+
johndoe:200000:65536
123+
```
124+
125+
For more information about `subgid`, refer to the [subgid documentation](https://man7.org/linux/man-pages/man5/subgid.5.html).
126+
127+
## Conclusion
128+
129+
Congratulations! You have successfully created a custom `ext2` image that can be used as a filesystem for CheerpX. This image is now ready to be loaded into your CheerpX environment for further testing and deployment.

0 commit comments

Comments
 (0)