You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The files to build a docker container with the applications I use for development
3
3
4
-
# Clone
4
+
# Important
5
+
The running image defaults to a user named "developer" with a uid of 1000.
6
+
7
+
You will be running the container with the idea of having "developer" map directly to your user so that it can modify your files. If your user is not uid 1000 then you will need to make use of the docker `userns-remap` feature: https://docs.docker.com/engine/security/userns-remap/
8
+
9
+
Configuration here requires that you modify the `/etc/subuid` and `/etc/subgid` files to map 1000 in the container to whatever your user uid is in the host.
10
+
11
+
## eg uid 1010
12
+
If your uid is 1010 then you will need to make sure that the uid's in the container are staggard by 10 in relation to your host. One way to achieve this is to start your `/etc/subuid` mappings from 9:
13
+
14
+
```
15
+
youruser:10:1000 # 0 in the container will map to 10 in the host
16
+
```
17
+
18
+
But this will mean that the root user (0) in the container will map to uid 9 in the host. I have made the "developer" user part of the sudo group so that we have the freedom to do whatever we want with the container. It is better to have 2 mappings with a 10 digit gap built in:
19
+
20
+
```
21
+
youruser:0:1000 # 0 - 999 inclusive
22
+
youruser:1010:1000 # 1000 in the container will map to 1010 in the host
23
+
```
24
+
25
+
## gid
26
+
A similar process needs to be performed for the `/etc/subgid` file.
27
+
28
+
## Docker daemon config
29
+
See the instructions in the link above to configure the daemon to run with this subordinate config in mind.
30
+
31
+
## Motivation
32
+
The purpose of creating a non-root user is not for security reasons. This is why I encourage the mapping of `youruser:0:...`. The purpose is becuase many applications don't run properly under root.
0 commit comments