Skip to content

Commit b5bfecd

Browse files
committed
Improved Dockerfile and README, #278
1 parent 65ddc7e commit b5bfecd

2 files changed

Lines changed: 42 additions & 8 deletions

File tree

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ LABEL org.opencontainers.image.source=https://github.com/akpw/mktxp
44
LABEL org.opencontainers.image.description="MKTXP is a Prometheus Exporter for Mikrotik RouterOS devices"
55
LABEL org.opencontainers.image.licenses=GPLv2+
66

7-
RUN addgroup -S mktxp && adduser -S mktxp -G mktxp
7+
RUN adduser -u 1000 -D mktxp
88
RUN apk add nano
99

10+
# Create standard config directory with proper ownership
11+
RUN mkdir -p /etc/mktxp && chown mktxp:mktxp /etc/mktxp
12+
1013
WORKDIR /mktxp
1114
COPY . .
1215
RUN pip install ./
1316

1417
EXPOSE 49090
1518

1619
USER mktxp
17-
ENTRYPOINT ["/usr/local/bin/mktxp"]
1820
ENV PYTHONUNBUFFERED=1
19-
CMD ["export"]
21+
CMD ["mktxp", "export"]

README.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,46 @@ Obviously, you can do the same via just opening the config file directly:
162162
```
163163

164164
#### Docker image install
165-
For Docker instances, one way is to use a configured `mktxp.conf` file from a local installation. Alternatively you can create a standalone one in a dedicated folder:
165+
The MKTXP Docker image runs as UID 1000 (standard user ID on most Linux distributions) to simplify file permissions when bind-mounting configuration files.
166+
167+
For Docker instances, you have several options for managing configuration:
168+
169+
**Option 1: Using `/etc/mktxp` (Recommended)**
170+
```bash
171+
# Create config directory and files
172+
mkdir mktxp-config
173+
nano mktxp-config/mktxp.conf # copy&edit sample entry(ies) from above
174+
nano mktxp-config/_mktxp.conf # optional: system configuration
175+
176+
# Run with dedicated config directory
177+
docker run -v "$(pwd)/mktxp-config:/etc/mktxp" -p 49090:49090 -it --rm \
178+
ghcr.io/akpw/mktxp:latest mktxp --cfg-dir /etc/mktxp export
166179
```
167-
mkdir mktxp
168-
nano mktxp/mktxp.conf # copy&edit sample entry(ies) from above
180+
181+
**Option 2: Mount individual files**
182+
```bash
183+
# Create config files
184+
nano mktxp.conf # copy&edit sample entry(ies) from above
185+
186+
# Mount only the config file (internal _mktxp.conf will be auto-created)
187+
docker run -v "$(pwd)/mktxp.conf:/etc/mktxp/mktxp.conf" -p 49090:49090 -it --rm \
188+
ghcr.io/akpw/mktxp:latest mktxp --cfg-dir /etc/mktxp export
169189
```
170-
Now you can mount this folder and run your docker instance with:
190+
191+
**Option 3: Legacy home directory method (backward compatible)**
192+
```bash
193+
mkdir mktxp
194+
nano mktxp/mktxp.conf # copy&edit sample entry(ies) from above
195+
196+
# Traditional mounting to home directory
197+
docker run -v "$(pwd)/mktxp:/home/mktxp/mktxp/" -p 49090:49090 -it --rm \
198+
ghcr.io/akpw/mktxp:latest
171199
```
172-
docker run -v "$(pwd)/mktxp:/home/mktxp/mktxp/" -p 49090:49090 -it --rm ghcr.io/akpw/mktxp:latest
200+
201+
**Getting shell access for debugging:**
202+
```bash
203+
# Easy shell access (no --entrypoint needed)
204+
docker run -v "$(pwd)/mktxp-config:/etc/mktxp" -it --rm ghcr.io/akpw/mktxp:latest sh
173205
```
174206

175207
#### MKTXP stack install

0 commit comments

Comments
 (0)