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
Copy file name to clipboardExpand all lines: README.md
+31-17Lines changed: 31 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Docker Python Waitress
1
+
# Python Waitress Docker Container
2
2
3
-
Docker container to run a WSGI Python app using
3
+
A Docker container to run a WSGI Python application using
4
4
[Waitress](https://docs.pylonsproject.org/projects/waitress/en/stable/index.html). Images support python 3.6+ and are
5
5
based on the [official python containers](https://hub.docker.com/_/python). The `-slim` versions are based on the similarly named python versions.
6
6
@@ -36,14 +36,14 @@ All options can be set using environment variables. These can be passed either i
36
36
-e flag to the docker call.
37
37
38
38
### Prestart Script
39
-
If you need to run any startup commands before waitress runs (an example might be running migrations) you can override the `prestart.sh` script. This script should live within the `/app` directory in the container. The image will automatically detect and run it before starting waitress.
39
+
If you need to run any startup commands before Waitress runs (an example might be running migrations) you can override the `prestart.sh` script. This script should live within the `/app` directory in the container. The image will automatically detect and run it before starting Waitress.
40
40
41
41
42
42
### Variables
43
43
44
44
#### `MODULE_NAME`
45
45
46
-
The Python "module" (file) to be imported by Gunicorn, this module would contain the actual application in a variable.
46
+
The Python "module" (file) to be imported by Waitress, this module would contain the actual application in a variable.
By default, Waitress has been setup to server on all hostnames on port 80 using both IPv4 and IPv6. This translates to `--listen:*:80`. This works for most applications using the basic setups listed above.
103
103
104
104
You may have different needs so you can adjust and manipulate this by passing in environment variable to adjust the settings.
105
105
106
106
There are 2 options for doing this.
107
107
1. Pass a comma separated list of `host:port,host:port` to the `WAITRESS_LISTEN` param
108
-
2. Pass the host and port separately as `WAITRESS_HOST` and/or `WAITRESS_PORT`. If port is left out, it will default to 80.
109
108
110
109
The `WAITRESS_LISTEN` param takes precedence over `WAITRESS_HOST`/`WAITRESS_PORT` options, meaning if you include all 3, host and port settings will be ignored.
111
110
112
-
##### Some examples
113
-
114
-
To set waitress to use port 8080, sent the `WAITRESS_LISTEN` param like `-e WAITRESS_LISTEN=*:8080`
111
+
To set Waitress to use port 8080, sent the `WAITRESS_LISTEN` param like
112
+
```bash
113
+
docker run -d -p 80:8080 -e WAITRESS_LISTEN=*:8080 myimage
114
+
````
115
115
116
-
If you want only IPv4, you could use advanced param listed in the section below, but you could also use `-e WAITRESS_HOST=0.0.0.0 -e WAITRESS_PORT=80`
116
+
2. Pass the host and port separately as `WAITRESS_HOST` and/or `WAITRESS_PORT`. If port is left out, it will default to 80.
117
117
118
+
If you want only IPv4, you could use advanced param listed in the section below, but you could also use
119
+
```bash
120
+
docker run -d -p 80:8080 -e WAITRESS_HOST=0.0.0.0 -e WAITRESS_PORT=8080 myimage
121
+
````
118
122
119
123
#### Advanced Options
120
124
121
125
Many of the
122
-
[supported options by waitress-serve](https://docs.pylonsproject.org/projects/waitress/en/stable/runner.html#invocation)
123
-
are also supported by passing in environment variables. These params are only included in the call if they are included
126
+
[options](https://docs.pylonsproject.org/projects/waitress/en/stable/runner.html#invocation) that can be passed to `waitress-serve`
127
+
can also supported by passing in environment variables. These params are only included in the call if they are included
124
128
in the environment. The supported options are:
125
129
126
130
| Environment Variable | Waitress Param |
@@ -139,13 +143,23 @@ in the environment. The supported options are:
0 commit comments