Java batch runtime with SSH access, cron scheduling and persistent storage; multiple JRE variants.
7.9K
Run Java batch applications manually or through cron, with SSH access and a persistent application directory. Starting the container starts cron and SSH; it does not automatically run a JAR.
| Tag | Java runtime |
|---|---|
latest | Currently the same image as jre-25 |
jre-25 | Eclipse Temurin JRE 25 |
jre-21 | Eclipse Temurin JRE 21 |
jre-17 | Eclipse Temurin JRE 17 |
jre-11 | Eclipse Temurin JRE 11 |
jre-8 | Eclipse Temurin JRE 8 |
Published platforms checked on 2026-11-08: linux/amd64. No native ARM64 variant is currently advertised. Older tags can have different startup behavior and configuration support; the runtime instructions below describe the current source and JRE 25 variant.
Tags are updated in place. A Java tag selects the runtime line, not a fixed Softfour image release. Use a digest when an exact image is required.
Provide an existing SSH public key; the private key stays on your client:
export BATCHES_AUTHORIZED_KEY="$(cat ~/.ssh/id_ed25519.pub)"
Save the following as compose.yaml:
services:
batches:
image: softfour/batches:jre-25
hostname: batches
restart: unless-stopped
environment:
BATCHES_TZ: "UTC"
BATCHES_AUTHORIZED_KEY: "${BATCHES_AUTHORIZED_KEY:?Set BATCHES_AUTHORIZED_KEY to your public key}"
ports:
- "127.0.0.1:2222:22"
volumes:
- batches:/opt/batches
volumes:
batches:
name: batches
docker compose config --quiet
docker compose up -d
Ports in this example are available only on the Docker host's loopback interface. Port 2222 forwards to SSH port 22; change the host port if it is already in use.
The explicit volume name preserves the existing batches volume convention. Use a unique volume name per deployment; when upgrading, reuse the original volume. Mount on /opt only for older volumes that already contain a nested batches directory.
After startup, copy a locally built executable JAR and run it as the batch account:
docker compose exec -T --user batches batches mkdir -p /opt/batches/jobs /opt/batches/logs
docker compose cp ./job.jar batches:/opt/batches/jobs/job.jar
docker compose exec -T --user batches batches /opt/java/openjdk/bin/java -jar /opt/batches/jobs/job.jar
The exit status of the last command is the batch exit status. Ensure application files are readable, and writable output directories are owned by batches, especially with bind mounts.
Create a local job.crontab file. This example runs at minute zero of every hour in the configured container time zone:
SHELL=/bin/sh
PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
0 * * * * cd /opt/batches && /opt/java/openjdk/bin/java -jar /opt/batches/jobs/job.jar >> /opt/batches/logs/job.log 2>&1
Install it and persist a copy for container recreation:
docker compose cp ./job.crontab batches:/opt/batches/.crontab
docker compose exec -T --user batches batches crontab /opt/batches/.crontab
docker compose exec -T --user batches batches crontab -l
docker compose exec -T --user batches batches tail -n 100 /opt/batches/logs/job.log
At startup, /opt/batches/.crontab is restored into the batches user's crontab. Use user-crontab syntax, without a username column. Cron jobs do not source interactive shell profiles; define the required environment explicitly. Prevent overlapping runs in the application or scheduling command when needed.
| Variable | Default | Purpose |
|---|---|---|
BATCHES_TZ | UTC | Time zone, for example Europe/Rome |
BATCHES_LOCALE_GEN | en_US.UTF-8 UTF-8 | Locale definition generated at startup |
BATCHES_LANG | en_US.UTF-8 | Process locale |
BATCHES_LANGUAGE | en_US:en | Language preference |
BATCHES_LC_ALL | en_US.UTF-8 | Locale override |
BATCHES_PATH | Java bin directory plus standard system paths | Runtime and SSH executable search path |
BATCHES_AUTHORIZED_KEY | Unset | Optional public key appended to authorized_keys; required by the example above |
BATCHES_AUTHORIZED_KEYS_FILE | Unset | Optional path inside the container to a readable file of public keys |
Set locale and time zone at runtime rather than rebuilding the image.
SSH accepts public-key authentication for batches only; root login and password authentication are disabled. To connect using the Compose example:
ssh -p 2222 [email protected]
For a mounted public-key file, set BATCHES_AUTHORIZED_KEYS_FILE to its container path and mount that file read-only. The entrypoint also creates an Ed25519 key pair under /opt/batches/.ssh when missing and adds its public key to authorized_keys. External access should normally use your own client public key as shown above, without distributing the generated private key.
Authorized keys are appended and persisted. Removing a key from an environment variable does not revoke a previously stored key; remove it from /opt/batches/.ssh/authorized_keys to revoke access.
The volume stores application files, .ssh and .ssh_host host identity keys. Back it up securely and do not share it between independent deployments. Persistence of host keys avoids unexpected identity changes on recreation. For permission failures, check ownership and SSH permissions (.ssh 0700, authorized_keys 0600). Do not publish SSH publicly unless required and protected by your deployment's access controls.
docker compose ps
docker compose logs --tail=100 batches
docker compose exec -T batches java -version
Container logs primarily show startup and SSH. Batch output goes to the invoking command or the log destination configured in cron. If a scheduled job does not run, inspect crontab -l, paths, permissions and the container time zone.
Back up the persistent volume and record the current image digest before upgrading. Keep the same volume mapping, then:
docker compose pull batches
docker compose up -d batches
Choose the Java tag compatible with your application. For rollback, restore the previous digest in the Compose image field (softfour/batches@sha256:...) and recreate the container. Application or data changes may also require restoring their matching backup.
Maintained by Softfour. For support, use your existing Softfour support channel and include the image tag, digest, platform and relevant logs with credentials removed.
The repository README is the source for this Docker Hub overview. Documentation updates do not change image contents. No versioned image changelog is currently published; record the digest before upgrading.
The runtime is based on Eclipse Temurin, with OpenSSH, cron and distribution packages. Third-party components retain their respective licenses. Contact Softfour for licensing information about image-specific files.
Content type
Image
Digest
sha256:07109805c…
Size
193.6 MB
Last updated
about 11 hours ago
docker pull softfour/batches