services: docker: Add new fields to support proxy.
The Docker proxy enables inter-container and outside-to-container loopback, and is required by the Docker registry server. * gnu/services/docker.scm (docker-configuration)[proxy, enable-proxy?]: Add fields. (docker-shepherd-service): Use them. (serialize-boolean): New function.
This commit is contained in:
parent
0b94911add
commit
7a31d93a61
|
@ -31,13 +31,25 @@
|
||||||
#:export (docker-configuration
|
#:export (docker-configuration
|
||||||
docker-service-type))
|
docker-service-type))
|
||||||
|
|
||||||
|
;;; We're not using serialize-configuration, but we must define this because
|
||||||
|
;;; the define-configuration macro validates it exists.
|
||||||
|
(define (serialize-boolean field-name val)
|
||||||
|
"")
|
||||||
|
|
||||||
(define-configuration docker-configuration
|
(define-configuration docker-configuration
|
||||||
(docker
|
(docker
|
||||||
(package docker)
|
(package docker)
|
||||||
"Docker daemon package.")
|
"Docker daemon package.")
|
||||||
(containerd
|
(containerd
|
||||||
(package containerd)
|
(package containerd)
|
||||||
"containerd package."))
|
"containerd package.")
|
||||||
|
(proxy
|
||||||
|
(package docker-libnetwork-cmd-proxy)
|
||||||
|
"The proxy package to support inter-container and outside-container
|
||||||
|
loop-back communications.")
|
||||||
|
(enable-proxy?
|
||||||
|
(boolean #t)
|
||||||
|
"Enable or disable the user-land proxy (enabled by default)."))
|
||||||
|
|
||||||
(define %docker-accounts
|
(define %docker-accounts
|
||||||
(list (user-group (name "docker") (system? #t))))
|
(list (user-group (name "docker") (system? #t))))
|
||||||
|
@ -66,7 +78,9 @@
|
||||||
(stop #~(make-kill-destructor)))))
|
(stop #~(make-kill-destructor)))))
|
||||||
|
|
||||||
(define (docker-shepherd-service config)
|
(define (docker-shepherd-service config)
|
||||||
(let* ((docker (docker-configuration-docker config)))
|
(let* ((docker (docker-configuration-docker config))
|
||||||
|
(enable-proxy? (docker-configuration-enable-proxy? config))
|
||||||
|
(proxy (docker-configuration-proxy config)))
|
||||||
(shepherd-service
|
(shepherd-service
|
||||||
(documentation "Docker daemon.")
|
(documentation "Docker daemon.")
|
||||||
(provision '(dockerd))
|
(provision '(dockerd))
|
||||||
|
@ -83,7 +97,10 @@
|
||||||
udev))
|
udev))
|
||||||
(start #~(make-forkexec-constructor
|
(start #~(make-forkexec-constructor
|
||||||
(list (string-append #$docker "/bin/dockerd")
|
(list (string-append #$docker "/bin/dockerd")
|
||||||
"-p" "/var/run/docker.pid")
|
"-p" "/var/run/docker.pid"
|
||||||
|
(if #$enable-proxy? "--userland-proxy" "")
|
||||||
|
"--userland-proxy-path" (string-append #$proxy
|
||||||
|
"/bin/proxy"))
|
||||||
#:pid-file "/var/run/docker.pid"
|
#:pid-file "/var/run/docker.pid"
|
||||||
#:log-file "/var/log/docker.log"))
|
#:log-file "/var/log/docker.log"))
|
||||||
(stop #~(make-kill-destructor)))))
|
(stop #~(make-kill-destructor)))))
|
||||||
|
|
Loading…
Reference in New Issue