Skip to content

Commit 80a3ddc

Browse files
committed
fix: remove user directive and document UID/GID config
- Remove redundant user: 1000:1000 from docker-compose (both services) - Add user ID check section to README (section 1b) - Update Config Reference table with clearer MYUID/MYGID description - Add comments to _template.env explaining how to find UID/GID
1 parent b56d029 commit 80a3ddc

5 files changed

Lines changed: 31 additions & 5 deletions

File tree

‎Dockerfile.cpu‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ RUN OLD_USER=$(awk -v uid="${MYUID}" -F ':' '$3==uid {print $1}' /etc/passwd) &&
4242
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/${USERNAME} && \
4343
chmod 0440 /etc/sudoers.d/${USERNAME} && \
4444
touch /home/${USERNAME}/.sudo_as_admin_successful && \
45-
echo 'export PS1="\[\e[01;36m\][DOCKER] \u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\$ "' >> /home/${USERNAME}/.bashrc
45+
echo 'export PS1="\[\e[01;36m\][DOCKER]\[\e[00m\] \u@\h:\w\$ "' >> /home/${USERNAME}/.bashrc
4646

4747
# ── Project configs ───────────────────────────────────────────────────────────
4848
COPY --chown=${USERNAME}:${MYGID} configs/opencode/ /home/${USERNAME}/.config/opencode/

‎Dockerfile.gpu‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN OLD_USER=$(awk -v uid="${MYUID}" -F ':' '$3==uid {print $1}' /etc/passwd) &&
4545
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/${USERNAME} && \
4646
chmod 0440 /etc/sudoers.d/${USERNAME} && \
4747
touch /home/${USERNAME}/.sudo_as_admin_successful && \
48-
echo 'export PS1="\[\e[01;36m\][DOCKER] \u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\$ "' >> /home/${USERNAME}/.bashrc
48+
echo 'export PS1="\[\e[01;36m\][DOCKER]\[\e[00m\] \u@\h:\w\$ "' >> /home/${USERNAME}/.bashrc
4949

5050
# ── NVIDIA ────────────────────────────────────────────────────────────────────
5151
ENV NVIDIA_VISIBLE_DEVICES=all

‎README.md‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,31 @@ PROJECT_PATH=/path/to/your/repo
2222
OPENCODE_CONFIG=free
2323
```
2424

25+
### 1b. Check your user ID
26+
27+
Files created by the container are owned by your user. To avoid ownership mismatches, your container user must have the same UID/GID as your host user.
28+
29+
Open a terminal on your **host** (outside Docker) and run:
30+
31+
```bash
32+
id
33+
```
34+
35+
You'll see something like:
36+
```
37+
uid=1000(yours) gid=1000(yours) groups=1000(yours),27(sudo)
38+
```
39+
40+
The numbers `1000` are your UID and GID.
41+
42+
- **If both are 1000**: default values work, no changes needed
43+
- **If different** (e.g. `uid=1001`): edit your `.env`:
44+
```env
45+
MYUID=1001
46+
MYGID=1001
47+
```
48+
Then rebuild: `docker compose build`
49+
2550
### 2. Start the container
2651

2752
```bash
@@ -136,7 +161,7 @@ uv run pytest
136161
|---------|----------|-------------|
137162
| `PROJECT_NAME` | Yes | Unique name — used for container naming |
138163
| `PROJECT_PATH` | Yes | Absolute path to your repo |
139-
| `MYUID` / `MYGID` | No | User/group ID (default: 1000) |
164+
| `MYUID` / `MYGID` | No | Must match your host user — run `id` to check (default: 1000) |
140165
| `OPENCODE_CONFIG` | No | Config preset: `free`, `paid`, `default` |
141166
| `ANTHROPIC_API_KEY` | No | Anthropic API key |
142167
| `OPENAI_API_KEY` | No | OpenAI API key |

‎configs/_template.env‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
PROJECT_NAME=my-project
22
PROJECT_PATH=/path/to/my-project
3+
4+
# User/group IDs — MUST match your host user (run `id` on your host)
5+
# If your UID/GID differs from 1000, replace with your actual values
36
MYUID=1000
47
MYGID=1000
58

‎docker-compose.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ services:
2424

2525
stdin_open: true
2626
tty: true
27-
user: "1000:1000"
2827

2928
volumes:
3029
- ${PROJECT_PATH:-.}:/home/hannya/workspace:rw
@@ -93,7 +92,6 @@ services:
9392

9493
stdin_open: true
9594
tty: true
96-
user: "1000:1000"
9795

9896
volumes:
9997
- ${PROJECT_PATH:-.}:/home/hannya/workspace:rw

0 commit comments

Comments
 (0)