Search code examples
dockerdocker-swarm

Docker execute Deluge as a Swarm service


I am new to Docker and I want to run Deluge as a Swarm service

I am running Docker inside OSX

First I started up Swarm

$ docker swarm init

Then I created an overlay network, that then I would use on the service

$ docker network create --driver overlay p2pnetwork

After that I created the service for Swarm

$ docker service create --name deluge \
    --network p2pnetwork \
    --replicas 1 \
    linuxserver/deluge \
    -e PUID=501 -e PGID=20 \
    -e TZ=ART \
    -e UMASK_SET=022 \
    -v /Users/agus/Downloads/torrents/incoming:/downloads \
    -v /Users/agus/Downloads/torrents/config:/config \
    -p 8112:80

Then when I collected this data

$ docker service ls
  ID                  NAME                MODE                REPLICAS            IMAGE                       PORTS
  0eydgjayj3q8        deluge              replicated          0/1                 linuxserver/deluge:latest


$ docker service ps deluge
  ID                  NAME                IMAGE                       NODE                DESIRED STATE       CURRENT STATE           ERROR                         PORTS
  xdut1h8riw56        deluge.1            linuxserver/deluge:latest   moby                Running             Starting 1 second ago
  8c54vkti22c8         \_ deluge.1        linuxserver/deluge:latest   moby                Shutdown            Failed 6 seconds ago    "task: non-zero exit (111)"
  3oan0xb349zi         \_ deluge.1        linuxserver/deluge:latest   moby                Shutdown            Failed 17 seconds ago   "task: non-zero exit (111)"
  xvri5grnmi4g         \_ deluge.1        linuxserver/deluge:latest   moby                Shutdown            Failed 27 seconds ago   "task: non-zero exit (111)"
  9rcmvxihyg91         \_ deluge.1        linuxserver/deluge:latest   moby                Shutdown            Failed 39 seconds ago   "task: non-zero exit (111)"


  $ docker service logs deluge
  deluge.1.xvri5grnmi4g@moby    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
  deluge.1.xdut1h8riw56@moby    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
  deluge.1.xvri5grnmi4g@moby    | [s6-init] ensuring user provided files have correct perms...exited 0.
  deluge.1.3oan0xb349zi@moby    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
  deluge.1.xvri5grnmi4g@moby    | [fix-attrs.d] applying ownership & permissions fixes...
  deluge.1.xdut1h8riw56@moby    | [s6-init] ensuring user provided files have correct perms...exited 0.
  deluge.1.8c54vkti22c8@moby    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
  deluge.1.8c54vkti22c8@moby    | [s6-init] ensuring user provided files have correct perms...exited 0.
  deluge.1.3oan0xb349zi@moby    | [s6-init] ensuring user provided files have correct perms...exited 0.
  deluge.1.xvri5grnmi4g@moby    | [fix-attrs.d] done.
  deluge.1.xdut1h8riw56@moby    | [fix-attrs.d] applying ownership & permissions fixes...
  deluge.1.xdut1h8riw56@moby    | [fix-attrs.d] done.
  deluge.1.8c54vkti22c8@moby    | [fix-attrs.d] applying ownership & permissions fixes...
  deluge.1.3oan0xb349zi@moby    | [fix-attrs.d] applying ownership & permissions fixes...
  deluge.1.xvri5grnmi4g@moby    | [cont-init.d] executing container initialization scripts...
  deluge.1.xvri5grnmi4g@moby    | [cont-init.d] 10-adduser: executing...
  deluge.1.xdut1h8riw56@moby    | [cont-init.d] executing container initialization scripts...
  deluge.1.8c54vkti22c8@moby    | [fix-attrs.d] done.
  deluge.1.3oan0xb349zi@moby    | [fix-attrs.d] done.
  deluge.1.3oan0xb349zi@moby    | [cont-init.d] executing container initialization scripts...
  deluge.1.xvri5grnmi4g@moby    | usermod: no changes
  deluge.1.xdut1h8riw56@moby    | [cont-init.d] 10-adduser: executing...
  deluge.1.8c54vkti22c8@moby    | [cont-init.d] executing container initialization scripts...
  deluge.1.8c54vkti22c8@moby    | [cont-init.d] 10-adduser: executing...
  deluge.1.3oan0xb349zi@moby    | [cont-init.d] 10-adduser: executing...
  deluge.1.xvri5grnmi4g@moby    |
  deluge.1.xdut1h8riw56@moby    | usermod: no changes
  deluge.1.xdut1h8riw56@moby    |
  deluge.1.8c54vkti22c8@moby    | usermod: no changes
  deluge.1.3oan0xb349zi@moby    | usermod: no changes
  deluge.1.xvri5grnmi4g@moby    | -------------------------------------
  deluge.1.xvri5grnmi4g@moby    |           _     _ _
  deluge.1.xdut1h8riw56@moby    | -------------------------------------
  deluge.1.8c54vkti22c8@moby    |
  deluge.1.3oan0xb349zi@moby    |
  deluge.1.3oan0xb349zi@moby    | -------------------------------------
  deluge.1.xvri5grnmi4g@moby    |          | |___| (_) ___
  deluge.1.xdut1h8riw56@moby    |           _     _ _
  deluge.1.8c54vkti22c8@moby    | -------------------------------------
  deluge.1.8c54vkti22c8@moby    |           _     _ _
  deluge.1.xvri5grnmi4g@moby    |          | / __| | |/ _ \
  deluge.1.3oan0xb349zi@moby    |           _     _ _
  deluge.1.xdut1h8riw56@moby    |          | |___| (_) ___
  deluge.1.xvri5grnmi4g@moby    |          | \__ \ | | (_) |
  deluge.1.8c54vkti22c8@moby    |          | |___| (_) ___
  deluge.1.3oan0xb349zi@moby    |          | |___| (_) ___
  deluge.1.xdut1h8riw56@moby    |          | / __| | |/ _ \
  deluge.1.8c54vkti22c8@moby    |          | / __| | |/ _ \
  deluge.1.xdut1h8riw56@moby    |          | \__ \ | | (_) |
  deluge.1.3oan0xb349zi@moby    |          | / __| | |/ _ \
  deluge.1.xvri5grnmi4g@moby    |          |_|___/ |_|\___/
  deluge.1.xvri5grnmi4g@moby    |                |_|
  deluge.1.8c54vkti22c8@moby    |          | \__ \ | | (_) |
  deluge.1.xdut1h8riw56@moby    |          |_|___/ |_|\___/
  deluge.1.3oan0xb349zi@moby    |          | \__ \ | | (_) |
  deluge.1.3oan0xb349zi@moby    |          |_|___/ |_|\___/
  deluge.1.xvri5grnmi4g@moby    |
  deluge.1.8c54vkti22c8@moby    |          |_|___/ |_|\___/
  deluge.1.xdut1h8riw56@moby    |                |_|
  deluge.1.3oan0xb349zi@moby    |                |_|
  deluge.1.8c54vkti22c8@moby    |                |_|
  deluge.1.xvri5grnmi4g@moby    | Brought to you by linuxserver.io
  deluge.1.xvri5grnmi4g@moby    | We gratefully accept donations at:
  deluge.1.3oan0xb349zi@moby    |
  deluge.1.xdut1h8riw56@moby    |
  deluge.1.8c54vkti22c8@moby    |
  deluge.1.8c54vkti22c8@moby    | Brought to you by linuxserver.io
  deluge.1.xvri5grnmi4g@moby    | https://www.linuxserver.io/donations/
  deluge.1.3oan0xb349zi@moby    | Brought to you by linuxserver.io
  deluge.1.xdut1h8riw56@moby    | Brought to you by linuxserver.io
  deluge.1.3oan0xb349zi@moby    | We gratefully accept donations at:
  deluge.1.8c54vkti22c8@moby    | We gratefully accept donations at:
  deluge.1.xvri5grnmi4g@moby    | -------------------------------------
  deluge.1.xvri5grnmi4g@moby    | GID/UID
  deluge.1.xdut1h8riw56@moby    | We gratefully accept donations at:
  deluge.1.3oan0xb349zi@moby    | https://www.linuxserver.io/donations/
  deluge.1.8c54vkti22c8@moby    | https://www.linuxserver.io/donations/
  deluge.1.8c54vkti22c8@moby    | -------------------------------------
  deluge.1.xvri5grnmi4g@moby    | -------------------------------------
  deluge.1.xdut1h8riw56@moby    | https://www.linuxserver.io/donations/
  deluge.1.3oan0xb349zi@moby    | -------------------------------------
  deluge.1.3oan0xb349zi@moby    | GID/UID
  deluge.1.8c54vkti22c8@moby    | GID/UID
  deluge.1.xvri5grnmi4g@moby    | User uid:    911
  deluge.1.xdut1h8riw56@moby    | -------------------------------------
  deluge.1.xdut1h8riw56@moby    | GID/UID
  deluge.1.3oan0xb349zi@moby    | -------------------------------------
  deluge.1.8c54vkti22c8@moby    | -------------------------------------
  deluge.1.xvri5grnmi4g@moby    | User gid:    911
  deluge.1.3oan0xb349zi@moby    | User uid:    911
  deluge.1.xdut1h8riw56@moby    | -------------------------------------
  deluge.1.xvri5grnmi4g@moby    | -------------------------------------
  deluge.1.8c54vkti22c8@moby    | User uid:    911
  deluge.1.8c54vkti22c8@moby    | User gid:    911
  deluge.1.3oan0xb349zi@moby    | User gid:    911
  deluge.1.xdut1h8riw56@moby    | User uid:    911
  deluge.1.xvri5grnmi4g@moby    |
  deluge.1.xvri5grnmi4g@moby    | [cont-init.d] 10-adduser: exited 0.
  deluge.1.8c54vkti22c8@moby    | -------------------------------------
  deluge.1.3oan0xb349zi@moby    | -------------------------------------
  deluge.1.xdut1h8riw56@moby    | User gid:    911
  deluge.1.xdut1h8riw56@moby    | -------------------------------------
  deluge.1.8c54vkti22c8@moby    |
  deluge.1.xvri5grnmi4g@moby    | [cont-init.d] 30-config: executing...
  deluge.1.3oan0xb349zi@moby    |
  deluge.1.3oan0xb349zi@moby    | [cont-init.d] 10-adduser: exited 0.
  deluge.1.xdut1h8riw56@moby    |
  deluge.1.8c54vkti22c8@moby    | [cont-init.d] 10-adduser: exited 0.
  deluge.1.xvri5grnmi4g@moby    | [cont-init.d] 30-config: exited 0.
  deluge.1.xvri5grnmi4g@moby    | [cont-init.d] done.
  deluge.1.3oan0xb349zi@moby    | [cont-init.d] 30-config: executing...
  deluge.1.xdut1h8riw56@moby    | [cont-init.d] 10-adduser: exited 0.
  deluge.1.8c54vkti22c8@moby    | [cont-init.d] 30-config: executing...
  deluge.1.3oan0xb349zi@moby    | [cont-init.d] 30-config: exited 0.
  deluge.1.xvri5grnmi4g@moby    | [services.d] starting services
  deluge.1.8c54vkti22c8@moby    | [cont-init.d] 30-config: exited 0.
  deluge.1.xvri5grnmi4g@moby    | [services.d] done.
  deluge.1.xdut1h8riw56@moby    | [cont-init.d] 30-config: executing...
  deluge.1.3oan0xb349zi@moby    | [cont-init.d] done.
  deluge.1.3oan0xb349zi@moby    | [services.d] starting services
  deluge.1.8c54vkti22c8@moby    | [cont-init.d] done.
  deluge.1.xvri5grnmi4g@moby    | exec: fatal: unable to exec -e: No such file or directory
  deluge.1.xdut1h8riw56@moby    | [cont-init.d] 30-config: exited 0.
  deluge.1.8c54vkti22c8@moby    | [services.d] starting services
  deluge.1.3oan0xb349zi@moby    | [services.d] done.
  deluge.1.xdut1h8riw56@moby    | [cont-init.d] done.
  deluge.1.xvri5grnmi4g@moby    | -e exited 111
  deluge.1.8c54vkti22c8@moby    | [services.d] done.
  deluge.1.xvri5grnmi4g@moby    | [cont-finish.d] executing container finish scripts...
  deluge.1.3oan0xb349zi@moby    | exec: fatal: unable to exec -e: No such file or directory
  deluge.1.xdut1h8riw56@moby    | [services.d] starting services
  deluge.1.xdut1h8riw56@moby    | [services.d] done.
  deluge.1.8c54vkti22c8@moby    | exec: fatal: unable to exec -e: No such file or directory
  deluge.1.xvri5grnmi4g@moby    | [cont-finish.d] done.
  deluge.1.3oan0xb349zi@moby    | -e exited 111
  deluge.1.3oan0xb349zi@moby    | [cont-finish.d] executing container finish scripts...
  deluge.1.xdut1h8riw56@moby    | exec: fatal: unable to exec -e: No such file or directory
  deluge.1.8c54vkti22c8@moby    | -e exited 111
  deluge.1.xvri5grnmi4g@moby    | [s6-finish] syncing disks.
  deluge.1.xvri5grnmi4g@moby    | [s6-finish] sending all processes the TERM signal.
  deluge.1.xdut1h8riw56@moby    | -e exited 111
  deluge.1.3oan0xb349zi@moby    | [cont-finish.d] done.
  deluge.1.8c54vkti22c8@moby    | [cont-finish.d] executing container finish scripts...
  deluge.1.8c54vkti22c8@moby    | [cont-finish.d] done.
  deluge.1.xvri5grnmi4g@moby    | [s6-finish] sending all processes the KILL signal and exiting.
  deluge.1.xdut1h8riw56@moby    | [cont-finish.d] executing container finish scripts...
  deluge.1.3oan0xb349zi@moby    | [s6-finish] syncing disks.
  deluge.1.3oan0xb349zi@moby    | [s6-finish] sending all processes the TERM signal.
  deluge.1.8c54vkti22c8@moby    | [s6-finish] syncing disks.
  deluge.1.xdut1h8riw56@moby    | [cont-finish.d] done.
  deluge.1.xdut1h8riw56@moby    | [s6-finish] syncing disks.
  deluge.1.3oan0xb349zi@moby    | [s6-finish] sending all processes the KILL signal and exiting.
  deluge.1.8c54vkti22c8@moby    | [s6-finish] sending all processes the TERM signal.
  deluge.1.8c54vkti22c8@moby    | [s6-finish] sending all processes the KILL signal and exiting.
  deluge.1.xdut1h8riw56@moby    | [s6-finish] sending all processes the TERM signal.
  deluge.1.xdut1h8riw56@moby    | [s6-finish] sending all processes the KILL signal and exiting.
  deluge.1.m73zgk69hz2u@moby    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
  deluge.1.m73zgk69hz2u@moby    | [s6-init] ensuring user provided files have correct perms...exited 0.
  deluge.1.m73zgk69hz2u@moby    | [fix-attrs.d] applying ownership & permissions fixes...
  deluge.1.m73zgk69hz2u@moby    | [fix-attrs.d] done.
  deluge.1.m73zgk69hz2u@moby    | [cont-init.d] executing container initialization scripts...
  deluge.1.m73zgk69hz2u@moby    | [cont-init.d] 10-adduser: executing...
  deluge.1.m73zgk69hz2u@moby    | usermod: no changes
  deluge.1.m73zgk69hz2u@moby    |
  deluge.1.m73zgk69hz2u@moby    | -------------------------------------
  deluge.1.m73zgk69hz2u@moby    |           _     _ _
  deluge.1.m73zgk69hz2u@moby    |          | |___| (_) ___
  deluge.1.m73zgk69hz2u@moby    |          | / __| | |/ _ \
  deluge.1.m73zgk69hz2u@moby    |          | \__ \ | | (_) |
  deluge.1.m73zgk69hz2u@moby    |          |_|___/ |_|\___/
  deluge.1.m73zgk69hz2u@moby    |                |_|
  deluge.1.m73zgk69hz2u@moby    |
  deluge.1.m73zgk69hz2u@moby    | Brought to you by linuxserver.io
  deluge.1.m73zgk69hz2u@moby    | We gratefully accept donations at:
  deluge.1.m73zgk69hz2u@moby    | https://www.linuxserver.io/donations/
  deluge.1.m73zgk69hz2u@moby    | -------------------------------------
  deluge.1.m73zgk69hz2u@moby    | GID/UID
  deluge.1.m73zgk69hz2u@moby    | -------------------------------------
  deluge.1.m73zgk69hz2u@moby    | User uid:    911
  deluge.1.m73zgk69hz2u@moby    | User gid:    911
  deluge.1.m73zgk69hz2u@moby    | -------------------------------------
  deluge.1.m73zgk69hz2u@moby    |
  deluge.1.m73zgk69hz2u@moby    | [cont-init.d] 10-adduser: exited 0.
  deluge.1.m73zgk69hz2u@moby    | [cont-init.d] 30-config: executing...
  deluge.1.m73zgk69hz2u@moby    | [cont-init.d] 30-config: exited 0.
  deluge.1.m73zgk69hz2u@moby    | [cont-init.d] done.
  deluge.1.m73zgk69hz2u@moby    | [services.d] starting services
  deluge.1.m73zgk69hz2u@moby    | [services.d] done.
  deluge.1.m73zgk69hz2u@moby    | exec: fatal: unable to exec -e: No such file or directory
  deluge.1.m73zgk69hz2u@moby    | -e exited 111
  deluge.1.m73zgk69hz2u@moby    | [cont-finish.d] executing container finish scripts...
  deluge.1.m73zgk69hz2u@moby    | [cont-finish.d] done.
  deluge.1.m73zgk69hz2u@moby    | [s6-finish] syncing disks.
  deluge.1.m73zgk69hz2u@moby    | [s6-finish] sending all processes the TERM signal.
  deluge.1.m73zgk69hz2u@moby    | [s6-finish] sending all processes the KILL signal and exiting.

It seems that the service is failing for the volumes, but I do not understand why or how to fix it

-- UPDATE

I also have some mistakes in the service declaration (besides the right answer)

docker service create --name deluge \
    --network p2pnetwork \
    --replicas 1 \
    -e PUID=501 -e PGID=20 \
    -e TZ=ART \
    -e UMASK_SET=022 \
    -p 8112:8112 \
    --mount type=bind,source=/Users/agus/Downloads/torrents,destination=/downloads \
    --mount type=bind,source=/Users/agus/Downloads/torrents/config,destination=/config \
    linuxserver/deluge

Also I need to change the download folders inside the deluge configuration and it worked


Solution

  • Docker Swarm Service uses a other syntax to mount volumes.

       docker service create --name deluge \
       --network p2pnetwork \
       --replicas 1 \
       linuxserver/deluge \
       -e PUID=501 -e PGID=20 \
       -e TZ=ART \
       -e UMASK_SET=022 \
       --mount type=bind,source=/Users/agus/Downloads/torrents/incoming,destination=/downloads \
       --mount type=bind,source=/Users/agus/Downloads/torrents/config,destination=/config \
       -p 8112:80
    

    "--mount". Hopefully the volume is available on all your Swarm-Members, if you search for a good way to share volumes between Swarm-Nodes, i would suggest: GlusterFS