Rclone with docker-compose = restart loop

What is the problem you are having with rclone?

Using the docker version with docker-compose, the container keeps restarting

Run the command 'rclone version' and share the full output of the command.

rclone v1.59.0

  • os/version: alpine 3.16.0
  • os/kernel: 5.15.32-v7l+ (armv7l)
  • os/type: linux
  • os/arch: arm
  • go/version: go1.18.3
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Dropbox

The command you were trying to run (eg rclone copy /tmp remote:tmp)

  rclone:
    image: rclone/rclone
    container_name: rclone
    restart: unless-stopped
    user: 1000:1000
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - ./rclone/config:/config/rclone
      - ./rclone/data:/data
    command: version
    cap_add:
      - SYS_ADMIN
    security_opt:
      - apparmor:unconfined

The rclone config contents with secrets removed.

[DropBox]

type = dropbox

token = {"access_token":"XXXXXXXXXXXXXXXXXXXXXXXXX"}


That compose looks like it's just running a version command.

What are you trying to do?

Thank you for taking a look. The version command is there simply as a test until I can figure it out why it keeps crashing/restarting. Once that is sorted, i will use a different command to sync my files.

Can you share some logs as I'm not sure what you mean by crashing/restarting?

Below is the output from running docker ps. As you'll see, under status, it shows restarting. What happens next is that it keeps restarting:

pi@raspberrypi:~ $ docker ps
CONTAINER ID   IMAGE                                          COMMAND                  CREATED             STATUS                                  PORTS                                                                                                                                 NAMES
45ae87301317   rclone/rclone                                  "rclone version"         About an hour ago   Restarting (0) Less than a second ago            

That's because you are running a single command, rclone version and you have

So it'll keep running that command over and over.

Thank you, I guess it shows I'm still quite new at this! I'm still trying to wrap my head around this, though. If I remove the "restart: unless-stopped" line, rclone runs the version command and then closes/stops running. If I want to schedule a task, how would I call on rclone if it is not running? I'm sure I am missing something really basic here, so thank you for your help and patience!

I'm probably not the best for that as I wouldn't use docker with rclone as for me, it's a single binary with a single config file so I find docker overkill for that.

I use docker for every the other apps I use, but not rclone.

Thanks for the help! I'm likely overcomplicating things by adding docker here, so I may reconsider my approach.

This docker-compose works for me

rclone:
        image: rclone/rclone:latest
        container_name: rclone
        environment:
            - PUID=1000
            - PGID=1000
        volumes:
            - type: bind
              source: /path/on/local/system
              target: /path/inside/container
              bind:
                propagation: shared
            - /home/$USER/.config/rclone:/root/.config/rclone
            - /etc/passwd:/etc/passwd:ro
            - /etc/group:/etc/group:ro
        devices:
            - /dev/fuse
        cap_add:
            - SYS_ADMIN
        security_opt:
            - apparmor:unconfined
        command: "mount etc etc"
        restart: unless-stopped

Give it a try maybe

Thank you! I'm guessing you are using this to mount a remote? The more I think about it, the more it makes sense that rclone would stop; after all, if I give it a sync command using a standard installation, it will also stop/shut down after completing the task. A very rudimentary approach could actually take advantage of this by letting docker re-launch rclone (i.e. run the desired command) at whatever interval docker tries to restart the container.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.