Skip to content

Commit 4512002

Browse files
authored
Update Docker instructions (#1254)
* Update README.rst Update Docker usage
1 parent c454a4c commit 4512002

File tree

1 file changed

+86
-3
lines changed

1 file changed

+86
-3
lines changed

README.rst

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PyModbus - A Python Modbus Stack
1212
.. image:: https://pepy.tech/badge/pymodbus
1313
:target: https://pepy.tech/project/pymodbus
1414
:alt: Downloads
15+
.. image:: https://ghcr-badge.deta.dev/pymodbus-dev/pymodbus/tags?label=Docker
16+
:target: https://github.com/pymodbus-dev/pymodbus/pkgs/container/pymodbus
17+
:alt: Docker Tags
1518

1619
------------------------------------------------------------
1720
Supported versions
@@ -229,9 +232,7 @@ This installs pymodbus in your virtual environment with pointers directly to the
229232
Either method will install all the required dependencies
230233
(at their appropriate versions) for your current python distribution.
231234

232-
------------------------------------------------------------
233-
Repository structure
234-
------------------------------------------------------------
235+
235236
The repository contains a number of important branches and tags.
236237
* **dev** is where all development happens, this branch is not always stable.
237238
* **master** is where are releases are kept.
@@ -242,6 +243,88 @@ If a maintenance release of an old version is needed (e.g. v2.5.4),
242243
the release tag is used to create a branch with the same name,
243244
and maintenance development is merged here.
244245

246+
-----------------------------------------------------------
247+
Install with Docker
248+
-----------------------------------------------------------
249+
Pull the latest image on ``dev`` branch with ``docker pull ghcr.io/pymodbus-dev/pymodbus:dev``::
250+
251+
doker pull ghcr.io/pymodbus-dev/pymodbus:dev
252+
dev: Pulling from pymodbus-dev/pymodbus
253+
548fcab5fe88: Pull complete
254+
a4d3f9f008ef: Pull complete
255+
eb83acb05730: Pull complete
256+
71cd28d529fd: Pull complete
257+
66607ad8f4f0: Pull complete
258+
64dff4c66d3b: Pull complete
259+
8b26e5718a7a: Pull complete
260+
dc87d8707532: Pull complete
261+
Digest: sha256:cfeee09a87dde5863574779416490fd47cacbb6f37332a3cdaf995c416e16b69
262+
Status: Downloaded newer image for ghcr.io/pymodbus-dev/pymodbus:dev
263+
ghcr.io/pymodbus-dev/pymodbus:dev
264+
265+
The image when run with out any further options supplied will start a repl server in non interactive mode.::
266+
267+
❯ docker run -it --rm -p 8080:8080 -p 5020:5020 ghcr.io/pymodbus-dev/pymodbus:dev
268+
269+
Reactive Modbus Server started.
270+
======== Running on http://127.0.0.1:8080 ========
271+
272+
===========================================================================
273+
Example Usage:
274+
curl -X POST http://127.0.0.1:8080 -d "{"response_type": "error", "error_code": 4}"
275+
===========================================================================
276+
277+
The default command can be overridden by passing any valid command at the end.::
278+
279+
❯ docker run -p 8080:8080 -p 5020:5020 -it --rm ghcr.io/pymodbus-dev/pymodbus:dev bash -c "pymodbus.server --help"
280+
281+
Usage: pymodbus.server [OPTIONS] COMMAND [ARGS]...
282+
283+
Reactive modebus server
284+
285+
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
286+
│ --host TEXT Host address [default: localhost] │
287+
│ --web-port INTEGER Web app port [default: 8080] │
288+
│ -b Support broadcast messages │
289+
│ --repl --no-repl Enable/Disable repl for server [default: repl] │
290+
│ --verbose --no-verbose Run with debug logs enabled for pymodbus [default: no-verbose] │
291+
│ --install-completion Install completion for the current shell. │
292+
│ --show-completion Show completion for the current shell, to copy it or customize the │
293+
│ installation. │
294+
│ --help Show this message and exit. │
295+
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
296+
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
297+
│ run Run Reactive Modbus server. │
298+
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
299+
300+
To check the repl console.::
301+
302+
❯ docker run -p 8080:8080 -p 5020:5020 -it --rm ghcr.io/pymodbus-dev/pymodbus:dev bash -c "pymodbus.console --help"
303+
Usage: pymodbus.console [OPTIONS] COMMAND [ARGS]...
304+
305+
Run Main.
306+
307+
Options:
308+
--version Show the version and exit.
309+
--verbose Verbose logs
310+
--broadcast-support Support broadcast messages
311+
--retry-on-empty Retry on empty response
312+
--retry-on-error Retry on error response
313+
--retries INTEGER Retry count
314+
--reset-socket / --no-reset-socket
315+
Reset client socket on error
316+
--help Show this message and exit.
317+
318+
Commands:
319+
serial Define serial communication.
320+
tcp Define TCP.
321+
322+
To run examples (assuming server is running). ::
323+
324+
❯ docker run -p 8080:8080 -p 5020:5020 -it --rm ghcr.io/pymodbus-dev/pymodbus:dev bash -c "examples/client_async.py"
325+
14:52:13 INFO client_async:44 ### Create client object
326+
14:52:13 INFO client_async:120 ### Client starting
327+
245328
------------------------------------------------------------
246329
Current Work In Progress
247330
------------------------------------------------------------

0 commit comments

Comments
 (0)