# Watchtower

##### Configure Watchtower

Watchtower has various configuration options. You can customize its behavior by passing environment variables or command-line arguments.

Here’s an example of running Watchtower with a few additional options:

```bash
# Stop and remove old container
docker stop watchtower && docker rm watchtower

# Run new fork (auto-detects API)
docker run -d \
  --name watchtower \
  --restart unless-stopped \
  -v /var/run/docker.sock:/var/run/docker.sock \
  nickfedor/watchtower
```

**WATCHTOWER\_CLEANUP=true** instructs Watchtower to remove old images after updating.  
**WATCHTOWER\_POLL\_INTERVAL=300** sets the interval for checking updates to every 5 minutes (300 seconds).

##### Run Once Command

Execute this one-shot container (replace image if using nickfedor fork):

```bash
docker run --rm \
  -v /var/run/docker.sock:/var/run/docker.sock \
  nickfedor/watchtower \
  --run-once
```

##### Verify Watchtower

To ensure Watchtower is running correctly, you can check its logs:

```bash
docker logs watchtower
```

If everything is set up properly, you'll see logs indicating that Watchtower is checking for updates and managing your Docker containers.

Such as this:

`root@test:~# docker logs watchtower`  
`time="2024-06-02T05:45:43Z" level=info msg="Watchtower 1.7.1"`  
`time="2024-06-02T05:45:43Z" level=info msg="Using no notifications"`  
`time="2024-06-02T05:45:43Z" level=info msg="Checking all containers (except explicitly disabled with label)"`  
`time="2024-06-02T05:45:43Z" level=info msg="Scheduling first run: 2024-06-02 05:50:43 +0000 UTC"`  
`time="2024-06-02T05:45:43Z" level=info msg="Note that the first check will be performed in 4 minutes, 59 seconds"`  
`time="2024-06-02T05:50:44Z" level=info msg="Session done" Failed=0 Scanned=2 Updated=0 notify=no`  
`time="2024-06-02T05:52:24Z" level=info msg="Waiting for running update to be finished..."`

<span style="color: rgb(224, 62, 45);">**Ins0mniA**</span>