Skip to content

Commit 4c70af2

Browse files
committed
use github docker registry
1 parent 3ca9fb7 commit 4c70af2

2 files changed

Lines changed: 52 additions & 30 deletions

File tree

docker/README.md

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ The Command Builder is a static Angular application served via nginx. It can be
1717
- Docker Engine 20.10 or later
1818
- Docker Compose V2 (optional, for using docker-compose.yml)
1919

20-
## Building the Docker Image
21-
22-
From the project root directory:
23-
24-
```bash
25-
docker build -f docker/Dockerfile -t command-builder:latest .
26-
```
27-
28-
Or with a custom tag:
29-
30-
```bash
31-
docker build -f docker/Dockerfile -t danielraab/command-builder:0.1.0 .
32-
```
3320

3421
## Running with Docker Run
3522

@@ -40,8 +27,9 @@ docker run -d \
4027
--name command-builder \
4128
-p 8080:80 \
4229
-v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \
43-
danielraab/command-builder:latest
30+
ghcr.io/danielraab/command-builder:latest
4431
```
32+
ensure that the `commands.json` file exists. remove the mount if you want use the commands.json from the repository (https://github.com/danielraab/command-builder/blob/master/public/commands.json).
4533

4634
### With Custom Commands File
4735

@@ -52,7 +40,7 @@ docker run -d \
5240
--name command-builder \
5341
-p 8080:80 \
5442
-v /path/to/your/commands.json:/usr/share/nginx/html/commands.json:ro \
55-
danielraab/command-builder:latest
43+
ghcr.io/danielraab/command-builder:latest
5644
```
5745

5846
### Options Explained
@@ -61,7 +49,7 @@ docker run -d \
6149
- `--name command-builder`: Assign a name to the container
6250
- `-p 8080:80`: Map port 80 from container to host port 8080
6351
- `-v`: Mount the commands.json file (`:ro` means read-only)
64-
- `danielraab/command-builder:latest`: The image to use
52+
- `ghcr.io/danielraab/command-builder:latest`: The image to use
6553

6654
## Running with Docker Compose
6755

@@ -108,7 +96,7 @@ docker run -d \
10896
--name command-builder \
10997
-p 3000:80 \
11098
-v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \
111-
danielraab/command-builder:latest
99+
ghcr.io/danielraab/command-builder:latest
112100
```
113101

114102
Then access the application at `http://localhost:3000`
@@ -138,6 +126,36 @@ The final image is based on `nginx:alpine`, providing a minimal footprint optimi
138126

139127
## Troubleshooting
140128

129+
### File mount error: "not a directory"
130+
131+
If you see an error like:
132+
```
133+
docker: Error response from daemon: failed to create task for container: OCI runtime create failed:
134+
unable to start container process: error mounting "/path/to/commands.json" to rootfs: not a directory
135+
```
136+
137+
**Cause**: Docker requires that the source file exists on the host before mounting. If the file doesn't exist, Docker creates a directory instead, causing the mount to fail.
138+
139+
**Solution**: Ensure the `public/commands.json` file exists before starting the container:
140+
141+
```bash
142+
# From the project root
143+
ls -la public/commands.json
144+
145+
# If the file doesn't exist, copy it from the repository
146+
# Or create it with proper content
147+
```
148+
149+
When running from a different directory, use absolute paths:
150+
151+
```bash
152+
docker run -d \
153+
--name command-builder \
154+
-p 8080:80 \
155+
-v /absolute/path/to/public/commands.json:/usr/share/nginx/html/commands.json:ro \
156+
ghcr.io/danielraab/command-builder:latest
157+
```
158+
141159
### Container won't start
142160

143161
Check the logs:
@@ -153,7 +171,7 @@ docker run -d \
153171
--name command-builder \
154172
-p 8081:80 \
155173
-v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \
156-
danielraab/command-builder:latest
174+
ghcr.io/danielraab/command-builder:latest
157175
```
158176

159177
### Commands not loading
@@ -191,39 +209,43 @@ docker-compose restart
191209
--cpus="0.5" \
192210
-p 8080:80 \
193211
-v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \
194-
danielraab/command-builder:latest
212+
ghcr.io/danielraab/command-builder:latest
195213
```
196214
3. **Use a reverse proxy** (nginx, Traefik) for SSL/TLS termination
197215
4. **Enable health checks** in production environments
198216
5. **Back up** your custom `commands.json` file regularly
199217

200218
## Building and Pushing to Registry
201219

202-
### Docker Hub
220+
### GitHub Container Registry (Default)
203221

204222
```bash
205223
# Build
206-
docker build -f docker/Dockerfile -t danielraab/command-builder:0.1.0 .
224+
docker build -f docker/Dockerfile -t ghcr.io/danielraab/command-builder:0.1.0 .
207225

208226
# Tag as latest
209-
docker tag danielraab/command-builder:0.1.0 danielraab/command-builder:latest
227+
docker tag ghcr.io/danielraab/command-builder:0.1.0 ghcr.io/danielraab/command-builder:latest
228+
229+
# Login
230+
echo $GITHUB_TOKEN | docker login ghcr.io -u danielraab --password-stdin
210231

211232
# Push
212-
docker push danielraab/command-builder:0.1.0
213-
docker push danielraab/command-builder:latest
233+
docker push ghcr.io/danielraab/command-builder:0.1.0
234+
docker push ghcr.io/danielraab/command-builder:latest
214235
```
215236

216-
### GitHub Container Registry
237+
### Docker Hub (Alternative)
217238

218239
```bash
219240
# Build
220-
docker build -f docker/Dockerfile -t ghcr.io/danielraab/command-builder:0.1.0 .
241+
docker build -f docker/Dockerfile -t danielraab/command-builder:0.1.0 .
221242

222-
# Login
223-
echo $GITHUB_TOKEN | docker login ghcr.io -u danielraab --password-stdin
243+
# Tag as latest
244+
docker tag danielraab/command-builder:0.1.0 danielraab/command-builder:latest
224245

225246
# Push
226-
docker push ghcr.io/danielraab/command-builder:0.1.0
247+
docker push danielraab/command-builder:0.1.0
248+
docker push danielraab/command-builder:latest
227249
```
228250

229251
## License

docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
command-builder:
3-
image: danielraab/command-builder:latest
3+
image: ghcr.io/danielraab/command-builder:latest
44
container_name: command-builder
55
ports:
66
- "8080:80"

0 commit comments

Comments
 (0)