Docker and docker-compose
Installing A-Parser on Linux and MacOS via Docker is the recommended method; we have prepared an image that includes all necessary dependencies and libraries for A-Parser and Headless Chrome to function.
Before installation
- Before installation, you need to register your IP in the Members Area.
- You must install Docker on your system.
Downloading the distribution
Download and unpack the A-Parser distribution:
curl -O https://a-parser.com/members/onetime/ce42f308eaa577b5/aparser-linux-x64.tar.gz
tar zxf aparser-linux-x64.tar.gz
rm -f aparser-linux-x64.tar.gz
The download is performed via a one-time link for Linux. You should get it in the Members Area, tab A-Parser -> Downloads
Running via Docker
Running in foreground mode
Run A-Parser in foreground mode to see the logs in the terminal:
docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t aparser/runtime ./aparser -foreground
The -foreground option outputs the log file content directly to the terminal:
Apr 27 07:06:53.10427 [master] foreground mode
Apr 27 07:06:54.06409 [master] Found local Chromium: /app/dist/nodejs/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome
Apr 27 07:06:55.36487 [master] NodeJS console: [Rank::CMS] total loaded 1446 apps
Apr 27 07:07:19.01377 [master] Start ProxyChecker nocheck
Apr 27 07:07:19.24418 [master] Start ProxyChecker default
Apr 27 07:07:19.62635 [master] A-Parser v1.2.1176-linux-x64 started, tasks: 0 / 2, memory total: 1989 MB, available: 610 MB
After starting, A-Parser will be available at http://127.0.0.1:9091
Running in the background
To run the container in the background, use the command:
docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t -d aparser/runtime ./aparser
Thread tuning when running via Docker
By default, there is a limit on the number of open files/sockets inside the container. To increase the limit to 10240 when running via Docker, use the --ulimit option:
docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 --ulimit nofile=10240:10240 -t -d aparser/runtime ./aparser
Additionally, it is recommended to perform Linux tuning for more threads on the host system.
Updating A-Parser in a Docker container
Stop the container:
docker stop aparser
Update A-Parser:
docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t aparser/runtime ./aparser -foreground -doupdate
After the update is complete, start A-Parser
You can also use the update via the interface or a one-time link
Running in Headful mode
To scrape websites that require running the browser in headful mode (with a virtual display), use the aparser/runtime:headful image.
To switch from a regular image to headful:
Stop the container:
docker stop aparser
Download the headful image:
docker pull aparser/runtime:headful
Start A-Parser with the new image:
docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t -d aparser/runtime:headful ./aparser
For docker-compose, replace the image in docker-compose.yml:
image: aparser/runtime:headful
Then run:
docker compose up -d
After starting, enable Chrome headless: 0 in the scraper settings. The log should display Headful when Chrome starts.
The novnc server is available on port 5900 for visual monitoring; the password is set via the VNC_PASSWORD variable (default: docker).
Running via docker-compose
Example docker-compose.yml
Create a docker-compose.yml file:
version: '3'
services:
a-parser:
image: aparser/runtime:latest
command: ./aparser
restart: always
volumes:
- ./aparser:/app
ports:
- 9091:9091
Running via docker-compose
Start A-Parser:
docker compose up -d
Tuning threads in docker-compose
When running via docker-compose, a limit on the number of open files/sockets applies inside the container. To increase the limit to 10240, add the ulimits block to the a-parser service:
services:
a-parser:
image: aparser/runtime:latest
command: ./aparser
restart: always
volumes:
- ./aparser:/app
ports:
- 9091:9091
ulimits:
nofile:
soft: 10240
hard: 10240
It is also recommended to perform Linux tuning for more threads on the host system.