|
162 | 162 | CAPS_DROP = ['ALL'] |
163 | 163 | CAPS_ADD = [] |
164 | 164 |
|
| 165 | +# User ability to map ports explicitly: |
| 166 | +# Unlike the probably safe `-P` run arg (which maps all exposed container ports |
| 167 | +# to random free host ports (world accessible)), giving users explicit control |
| 168 | +# over port mappings is probably not the best idea, as they are likely to |
| 169 | +# collide on frequently used ports such as 5000 or 8080. |
| 170 | +# Also it might unintentionally allow them to bind ports in the root range if |
| 171 | +# you are not careful. |
| 172 | +# For flexibility, we allow you to specify regexps that each -p arg is matched |
| 173 | +# against one by one. Only if each of the user's -p args matches at least one of |
| 174 | +# these, the docker run command is executed. If the list is empty, the -p |
| 175 | +# argument is neither allowed nor shown to the user. |
| 176 | +ALLOWED_PORT_MAPPINGS = [ |
| 177 | + # useful defaults: most similar to -P, but allows users to select |
| 178 | + # ports instead of mapping all exposed publicly. Also might allow them to |
| 179 | + # bind them local to host only: |
| 180 | + r'^127\.0\.0\.1::[0-9]+$', # local access from host (via random free port) |
| 181 | + '^[0-9]+$', # public access (via random free host port) |
| 182 | + |
| 183 | + # more examples: |
| 184 | + |
| 185 | + # allow `-p 127.0.0.1:5000-6000:80`, so user can map container 80 to |
| 186 | + # random host port in range of 5000-6000 that is only accessible from host: |
| 187 | + # r'^127\.0\.0\.1:5000-6000:80$' |
| 188 | + |
| 189 | + # allow `-p 8080:80`, so user can map container 80 to host 8080 (if free): |
| 190 | + # '^8080:80$' # probably useful in user-specific configs |
| 191 | + |
| 192 | + # allow all (probably bad idea!): |
| 193 | + # '^.*$', # allows all, probably bad idea! |
| 194 | +] |
| 195 | + |
165 | 196 | # Environment vars to set for the container: |
166 | 197 | ENV_VARS = [ |
167 | 198 | # sets HOME env var to user's home |
|
0 commit comments