Skip to content

Commit 30e437b

Browse files
sebastianrakelmflatt
authored andcommitted
Add possibility to pass port forwarding to container
1 parent 43946e5 commit 30e437b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

remote-shell-lib/docker.rkt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#:memory-mb (or/c #f exact-nonnegative-integer?)
4040
#:swap-mb (or/c #f exact-nonnegative-integer?)
4141
#:envvars (hash/c string? string?)
42+
#:ports (hash/c integer? integer?)
4243
#:replace? boolean?)
4344
. ->* .
4445
string?)]
@@ -157,6 +158,7 @@
157158
#:memory-mb [memory-mb #f]
158159
#:swap-mb [swap-mb #f]
159160
#:envvars [envvars (hash)]
161+
#:ports [ports (hash)]
160162
#:replace? [replace? #f])
161163
(when replace?
162164
(define id (docker-id #:name name))
@@ -178,6 +180,8 @@
178180
(~a "--volume=" (car vol) ":" (cadr vol) ":" (caddr vol)))
179181
(for/list ([key (in-hash-keys envvars)])
180182
(~a "-e " key "=" (hash-ref envvars key)))
183+
(for/list ([key (in-hash-keys ports)])
184+
(~a "-p" key ":" (hash-ref ports key)))
181185
(if (or memory-mb swap-mb)
182186
(list (format "--memory=~am" (or memory-mb swap-mb))
183187
(format "--memory-swap=~am" (+ (or memory-mb swap-mb) (or swap-mb memory-mb))))

0 commit comments

Comments
 (0)