Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image constantly restarting #181

Closed
lnlyssg opened this issue Oct 3, 2024 · 2 comments
Closed

Docker image constantly restarting #181

lnlyssg opened this issue Oct 3, 2024 · 2 comments

Comments

@lnlyssg
Copy link

lnlyssg commented Oct 3, 2024

cc'ing @benyafai

I'm using the below docker-compose to run fedifetcher however I've noticed that it's constantly running, ending and running again within minutes (or even seconds) as per the below screenshot from my Healthchecks instance. It seems that it's not picking up the delay in the restart_policy but I'm not sure why?

Screenshot 2024-10-03 at 09 49 36
services:
  fedifetcher:
    container_name: fedifetcher
    stdin_open: true
    tty: true
    image: ghcr.io/nanos/fedifetcher:latest
    command: "--access-token=${TOKEN} --server=${SERVER} --config=/app/artifacts/config.json"
    # Persist our data
    volumes:
      - /opt/fedifetcher/:/app/artifacts
    # Use the `deploy` option to enable `restart_policy`
    deploy:
      # Don't go above 1 replica to avoid multiple overlapping executions of the script
      replicas: 1
      restart_policy:
        # The `any` condition means even after successful runs, we'll restart the script
        condition: any
        # Specify how often the script should run - for example; after 1 hour.
        delay: 1h
@benyafai
Copy link
Contributor

benyafai commented Oct 3, 2024

It seems docker compose ignores the delay command, it only works when deployed as a swarm/stack. I apologise I didn't see this, in my limited testing I thought I had it working.

I 'solved' it by creating my own entrypoint in the compose file and adding a basic unix sleep command like below.

entrypoint: ["sh", "-c", "python /app/find_posts.py --access-token=<TOKEN> --server=<SERVER>; sleep 3600; "]

I'll create a pull for this, but @nanos can feel free to remove the example entirely if it doesn't fit as well any more!

@nanos
Copy link
Owner

nanos commented Oct 4, 2024

Thanks @benyafai ! I will take a look at this now

@nanos nanos closed this as completed Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants