Requirements
| Aspect | Dockerfile | Dockerfile.distroless |
|---|---|---|
| Shell & Tools | ✅ Includes shell and tools | ❌ Minimal, no shell or tools |
| Debugging | ✅ Easier debugging with shell and tools | ❌ Harder to debug due to minimal environment |
| Health Checks | ✅ Supports complex health checks | ❌ Health checks need to be simple or directly executable |
| Image Size | ❌ Larger image size | ✅ Smaller image size |
| Customization | ✅ Easier to customize with additional packages | ❌ Limited customization options |
| Attack Surface | ❌ Larger attack surface due to more installed packages | ✅ Reduced attack surface |
| Libraries | ✅ More libraries available | ❌ Limited libraries |
| Start-up Time | ❌ Slower start-up time due to larger image size | ✅ Faster start-up time |
| Tool Compatibility | ✅ Compatible with more tools and libraries | ❌ Compatibility limitations with certain tools |
| Maintenance | ❌ Higher maintenance due to larger image and dependencies | ✅ Lower maintenance with minimal base image |
| Custom uid/gid | ✅ It’s possible to pass in PUID and PGID | ❌ PUID and PGID are not supported |
Building image
To proceed with building, you must specify the Anki version you want, by replacing<version> with something like 24.11 and <Dockerfile> with the chosen Dockerfile (e.g., Dockerfile or Dockerfile.distroless)
The --platform option specifies which systems the image will be able to run on after it has been built. This is helpful in scenarios where you are building the image on one architecture (eg: an M series Mac) but running the image on another architecture (eg: x86 Linux server).
linux/amd64is for x86 linux systems (Images built with this option will work on Windows as well through WSL2 which is included with Docker Desktop)linux/arm64is for ARM systems (eg: M series Macs)
Resource Exhausted:.... cannot allocate memory, go to Docker Desktop > Settings > Resources and increase the memory limit.
If you are unsure of what platform your system is, just run the command below without the platform option.
Run container
Once done with build, you can proceed with running this image with the following command:Dockerfile you can specify the
PUID and PGID env variables for the user and group id of the process that
will run the anki-sync-server process. This is valuable when you want the files
written and read from the /anki_data volume to belong to a particular
user/group e.g. to access it from the host or another container. Note the the
ids chosen for PUID and PGID must not already be in use inside the
container (1000 and above is fine). For example add -e "PUID=1050" and -e "PGID=1050" to the above command.
If you want to have multiple Anki users that can sync their devices, you can
specify multiple SYNC_USER as follows:
SYNC_BASE and
SYNC_PORT will be ignored. In the first case for safety reasons, to avoid
accidentally placing data outside the volume and the second for simplicity
since the internal port of the container does not matter given that you can
change the external one.