Run wkhtmltoimage in a container by using an image that contains the executable, its runtime libraries and fonts, then mount a host directory and pass the input and output paths as paths inside that mount. The basic pattern is docker run --rm -v "$PWD:/work" -w /work <pinned-image> wkhtmltoimage input.html output.png. It is an illustrative adaptation of the documented CLI syntax and Docker mount pattern, not a tested command for a particular image. wkhtmltoimage runs headlessly, so it does not need an X server or display service; its older Qt WebKit engine and archived upstream repositories make careful image selection and application-specific testing important.
What wkhtmltoimage does in Docker
wkhtmltoimage is a command-line program in the wkhtmltopdf project that renders a web page or HTML input to an image. Its documented command shape is wkhtmltoimage [OPTIONS]... <input file> <output file>. In Docker, the container supplies the program and its dependencies; a bind mount makes files in a host directory visible to the process and lets the generated image persist after the container exits. The upstream project describes wkhtmltoimage as headless, so you do not need to install or start a display server merely to run it.
The command is simple; selecting a trustworthy, compatible image is the harder part. The upstream source repository was archived on January 2, 2023, and the packaging repository was archived on August 28, 2023. The packaging releases page lists 0.12.6.1 r3, with release assets dated May 2023. Treat wkhtmltoimage as a legacy renderer: pin the executable or image version, and verify the pages and assets your application actually needs.
Choose an image you can trust and reproduce
You can build your own image or use a community image. A prebuilt image may be convenient, but its presence on a registry does not establish that it is maintained, suitable for your architecture, or built with the Qt variant your application needs. Docker recommends using trusted images and warns about untrusted images and Dockerfiles in its security guidance.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
| Check | Why it matters |
|---|---|
| Source and build instructions | Review where the image comes from and how its executable was built before running it with access to your files. |
| Base distribution and architecture | Runtime packages and available binaries differ by distribution and CPU architecture. Confirm that the image matches the environment where you will run it. |
| Version and digest | Pin a version, and consider pinning an image digest for repeatable deployments. Avoid a mutable latest tag when the exact renderer matters. |
| Libraries and fonts | Confirm the image includes the shared libraries and fonts required by its particular build; a small base image may omit them. |
| Qt build and update history | Check whether the build is appropriate for your application and whether the publisher provides enough provenance to assess it. Do not assume a community image has a patched-Qt build or ongoing updates. |
The minidocks/wkhtmltopdf Docker Hub page illustrates mounting a working directory for the companion command. The page’s image update metadata was already more than two years old when it was reviewed; that alone is a reason to check its current tag, source and digest rather than treating it as a maintained or Docker-endorsed image. The example below uses a placeholder image deliberately: choose and pin an image only after checking it for your environment.
Run a local HTML file and save the image on the host
- Make a working directory. Put the input HTML and any assets it needs in a directory you are comfortable mounting. For example, use a project directory containing
input.html. - Choose the image. Replace
<pinned-image>with the inspected image name and immutable version or digest you intend to use. - Mount the directory. The example mounts the current host directory at
/workin the container and sets the container working directory to/work. - Pass container paths. Run the executable with input and output paths as seen inside the container, not host paths. The output file will be written into the mounted directory.
docker run --rm
-v "$PWD:/work"
-w /work
<pinned-image>
wkhtmltoimage input.html output.png
This is a command skeleton adapted from the CLI synopsis and the Docker Hub mount pattern; it has not been executed against a particular image. The image must provide an executable available as wkhtmltoimage. After the container exits, check that output.png exists in the host directory and is readable. Choose an output extension supported by the selected build; the command’s input and output arguments identify the files, while the available behavior can vary with the build.
For a web page rather than a local file, provide the page URL as the input argument and write the output to a path in the mounted directory, for example:
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
docker run --rm
-v "$PWD:/work"
-w /work
<pinned-image>
wkhtmltoimage https://example.com /work/page.png
Use a URL your container can reach. A remote page may load differently from a local file because it can depend on network access and remote resources. Check the resulting file rather than assuming a successful process exit means the image matches your expectations.
Free tools Windows power users keep installed
One-click scans. No signup required.
Allow local assets without exposing more files than necessary
Local-file access is a security boundary, not just a rendering convenience. The upstream 0.12.6 release notes identify blocking local filesystem access by default as a breaking change, and the Debian wkhtmltoimage manual documents --allow <path> for permitting access to files from a specified folder. If HTML refers to local stylesheets, images or other resources, allow only the directory that contains what the render needs, subject to the behavior of the build you selected.
docker run --rm
-v "$PWD:/work"
-w /work
<pinned-image>
wkhtmltoimage --allow /work input.html output.png
Do not mount a broad host path such as a home directory simply to make a missing asset resolve. Keep the mount narrow, inspect the HTML’s referenced files, and grant the renderer access only to the directory it needs. The exact local-file behavior should be verified with your chosen build, especially when upgrading or switching images.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Build a custom image only with distribution-matched dependencies
A minimal container can fail even though the command exists: wkhtmltoimage needs the runtime libraries for its build, and rendering also depends on fonts being available. The archived upstream Debian package manifest lists dependencies including fontconfig, FreeType, JPEG and PNG libraries, OpenSSL, X11 libraries, xfonts packages and zlib. These names are a reference for that Debian packaging context, not a universal install line. Package names and compatibility differ across distributions and versions.
If you build an image, start from a base that matches the binary or package you have chosen. Install dependencies from that distribution’s package sources, copy or install the corresponding wkhtmltoimage build, and verify it inside the final runtime image. Avoid copying Debian package names into Alpine or another distribution without checking the packages and binary compatibility. Keep the Dockerfile and source details available to your team so the image can be audited and rebuilt.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteNo single complete Dockerfile is appropriate without knowing the selected base distribution, architecture and binary source. In particular, the archived upstream repositories mean you should not assume that a package URL, download location or dependency recipe remains current. Make the version choice explicit, inspect the source of the binary, and test the resulting image before using it for production output.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Verify the container before relying on its output
- Confirm the executable: run
wkhtmltoimage --versionin the image and check that the reported version is the one you intended to pin. - Confirm the mount: verify the input file is visible at the container path you pass and that the process can write to the mounted output directory.
- Check the artifact: confirm the output file exists on the host after the container exits, has nonzero size, and opens in the image viewer or downstream process you use.
- Test representative pages: include pages with the same local assets, fonts, remote resources and layout requirements as your real workload. The available evidence does not establish broad compatibility with current web standards.
- Record the image identity: keep the version or digest in your deployment configuration so a later pull does not silently change the renderer.
Headless operation only means there is no display service requirement. It does not guarantee that fonts, resource loading, page layout or modern web features will match a full contemporary browser. Validate visual results against your own pages rather than inferring compatibility from a successful command.
Common failures and practical fixes
| Symptom | Likely cause | What to check or change |
|---|---|---|
wkhtmltoimage: not found or an entrypoint error |
The selected image does not contain the executable under that command name, or the command is not on its runtime path. | Inspect the image provenance and contents, then use an image that provides the intended binary. Verify with wkhtmltoimage --version. |
| Input file cannot be opened | The host directory was not mounted where expected, or the command uses a host path rather than an in-container path. | Check the -v mapping, working directory and filename. Use paths under the mounted container directory. |
| Output is missing or cannot be written | The output path is outside the mount, the target directory is not writable, or the command failed before producing an artifact. | Write to the mounted directory, inspect file permissions and process output, and check for the file on the host after exit. |
| Shared-library or loader error | The runtime image lacks dependencies or the binary does not match the base distribution or architecture. | Use a compatible binary/base pair and add the runtime dependencies required by that build. Do not assume package names are portable across distributions. |
| Blank or incomplete render | Resources may be inaccessible, local-file access may be blocked, fonts may be absent, or the page may rely on features this legacy renderer does not handle as expected. | Check the input, resource paths and fonts; narrowly allow needed local files with --allow; compare behavior on a representative page. |
| Works on one machine but changes after deployment | A mutable image tag or unpinned binary can resolve to a different build; distribution or architecture may also differ. | Pin the image version or digest and record the base and architecture used to validate it. |
Performance, reliability and cost considerations
Docker does not make a legacy renderer more actively maintained or compatible with newer page behavior. Both upstream GitHub repositories are archived, and the packaging releases page’s latest listed release is dated May 2023. For a production workflow, make the renderer version and image provenance visible, test each relevant page class, and decide how the application will handle failed or visually incorrect renders. Do not treat an old community image’s availability as evidence of security updates.
Runtime and image size depend on the selected build, its dependencies, the page, and the resources it must load; the cited material does not establish a reliable speed or resource benchmark. Measure your own workload if throughput or latency matters. Likewise, there is no universal installation or hosting cost implied by this command: local Docker use requires a suitable environment and a compatible image, while any persistent service introduces deployment choices beyond the command itself.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Or skip the browser setup
If your actual goal is to capture a website rather than operate this legacy renderer, ScreenshotNeo is a website screenshot API and MCP server. A GET request can return a PNG, JPEG, WebP or PDF. Its API accepts cookie banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. AI agents can use its MCP server tools, including take_screenshot, get_page_info and capture_pdf.
For example, this cURL request captures a URL to a WebP file; replace the example URL and provide your API key:
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-o shot.webp
See the ScreenshotNeo API documentation for request parameters and response details. ScreenshotNeo includes 1,000 screenshots per month on its free plan without a card; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan and try 1,000 screenshots a month with no card.
Frequently Asked Questions
Does wkhtmltoimage need an X server in Docker?
No. The upstream project describes it as headless, so a display service is not required.
Can I use a host file path as the input inside the container?
No. The file must be visible through a mount, and the command must use the path as it appears inside the container.
Is wkhtmltoimage actively maintained?
The upstream source and packaging repositories are archived. The packaging releases page lists 0.12.6.1 r3 as its latest release, dated May 2023.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

