Docker Configuration
Start on Boot​
To run the container automatically on system startup, run it with the --restart always
option.
For a complete list of start options, see Docker start on boot.
docker run \
--restart always \
-t \
-p 8080:8080 \
-v license:/license \
-e TOKEN=YYYYY \
-e LICENSE_KEY=XXXXX \
platerecognizer/alpr
danger
For the command above, make sure to replace XXXXX with your Snapshot SDK License Key and YYYYY with your API Token. Get your token and license key.
Networking​
- Add
--network=host
to use the host's networking directly. - You may use a different port if 8080 is already used. For example, to use port 8888 do
-p 8888:8080
. - Add
--detach
to run container in the background.
Are you experiencing connection errors (Failed to establish a new connection)?​
After a resume from sleep or on an unstable network (lots of disconnections), the overlay network may stop working. Restarting Docker Desktop or the Docker daemon will fix this issue. Another solution is to switch to host networking (see above).
Speed Optimization​
- By default, the SDK starts a single worker process. To fully use the machine's compute, you can enable multiple workers. For example, adding
-e WORKERS=2
todocker run
will start 2 worker processes.- When this is enabled, it is preferred to call the API in a multi-threaded fashion.
- When Snapshot is processing a request, 15-20% of the work is done on a single core and the rest is using all the cores. On a device with 2 cores or less changing WORKERS will not make much difference. It can be interesting to play with that knob when the device has 4-8 cores.
- Faster inference can also be achieved using the
config
parameter. See details in our documentation. - When using a compressed image format like JPEG or PNG, the SDK will need to decode the image before processing it. To skip the decoding step, prefer an uncompressed format like BMP, PPM, PNM or SGI.
info
Previously available PROCESS_GPU_FRACTION
environment variable is no longer supported.