Skip to content

Commit 16a6967

Browse files
B4nanclaude
andauthored
docs: improve Docker image version pinning guidance (#3349)
- Update best practices to recommend pinning both Node.js and automation library versions for reproducible builds - Add warning about version matching importance between Dockerfile and package.json - Document the asterisk `*` approach as an alternative rather than the primary recommendation - Add "Finding available tags" section with Docker Hub links and programmatic query example Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6cd9456 commit 16a6967

2 files changed

Lines changed: 94 additions & 10 deletions

File tree

docs/guides/docker_images.mdx

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,37 @@ FROM apify/actor-node-playwright-chrome:20-1.10.0-beta
6969

7070
## Best practices
7171

72-
- Node.js version tag should **always** be used.
73-
- The automation library version tag should be used for **added security**.
74-
- Asterisk `*` should be used as the automation library version in our `package.json` files.
72+
For production crawlers, we recommend pinning both the Node.js version **and** the automation library version in your Dockerfile tag. This ensures reproducible builds and prevents unexpected behavior when new versions are released.
7573

76-
It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image.
74+
### Recommended approach: Pin both versions
75+
76+
Match the automation library version in your `package.json` with the version in your Docker image tag:
7777

7878
```dockerfile
79-
FROM apify/actor-node-playwright-chrome:20
79+
FROM apify/actor-node-playwright-chrome:22-1.52.0
80+
```
81+
82+
```json
83+
{
84+
"dependencies": {
85+
"crawlee": "^3.0.0",
86+
"playwright": "1.52.0"
87+
}
88+
}
89+
```
90+
91+
:::warning Why version matching matters
92+
93+
If you pin the Docker image to `22-1.52.0` but install a different Playwright version via `package.json`, you may encounter browser compatibility issues. The browsers pre-installed in the image are specifically built for that Playwright version.
94+
95+
:::
96+
97+
### Alternative approach: Using asterisk `*`
98+
99+
You can also use asterisk `*` as the automation library version in your `package.json`:
100+
101+
```dockerfile
102+
FROM apify/actor-node-playwright-chrome:22
80103
```
81104

82105
```json
@@ -88,6 +111,25 @@ FROM apify/actor-node-playwright-chrome:20
88111
}
89112
```
90113

114+
This makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. However, this approach is less predictable because you'll get whatever version was latest when the Docker image was built.
115+
116+
## Finding available tags
117+
118+
To see all available tags for each image, you can visit Docker Hub directly:
119+
120+
- [apify/actor-node](https://hub.docker.com/r/apify/actor-node/tags)
121+
- [apify/actor-node-puppeteer-chrome](https://hub.docker.com/r/apify/actor-node-puppeteer-chrome/tags)
122+
- [apify/actor-node-playwright](https://hub.docker.com/r/apify/actor-node-playwright/tags)
123+
- [apify/actor-node-playwright-chrome](https://hub.docker.com/r/apify/actor-node-playwright-chrome/tags)
124+
- [apify/actor-node-playwright-firefox](https://hub.docker.com/r/apify/actor-node-playwright-firefox/tags)
125+
- [apify/actor-node-playwright-webkit](https://hub.docker.com/r/apify/actor-node-playwright-webkit/tags)
126+
127+
You can also query available tags programmatically:
128+
129+
```bash
130+
curl -s "https://registry.hub.docker.com/v2/repositories/apify/actor-node-playwright-chrome/tags?page_size=50" | jq '.results[].name'
131+
```
132+
91133
### Warning about image size
92134

93135
Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need.

website/versioned_docs/version-3.15/guides/docker_images.mdx

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,37 @@ FROM apify/actor-node-playwright-chrome:20-1.10.0-beta
6969

7070
## Best practices
7171

72-
- Node.js version tag should **always** be used.
73-
- The automation library version tag should be used for **added security**.
74-
- Asterisk `*` should be used as the automation library version in our `package.json` files.
72+
For production crawlers, we recommend pinning both the Node.js version **and** the automation library version in your Dockerfile tag. This ensures reproducible builds and prevents unexpected behavior when new versions are released.
7573

76-
It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image.
74+
### Recommended approach: Pin both versions
75+
76+
Match the automation library version in your `package.json` with the version in your Docker image tag:
7777

7878
```dockerfile
79-
FROM apify/actor-node-playwright-chrome:20
79+
FROM apify/actor-node-playwright-chrome:22-1.52.0
80+
```
81+
82+
```json
83+
{
84+
"dependencies": {
85+
"crawlee": "^3.0.0",
86+
"playwright": "1.52.0"
87+
}
88+
}
89+
```
90+
91+
:::warning Why version matching matters
92+
93+
If you pin the Docker image to `22-1.52.0` but install a different Playwright version via `package.json`, you may encounter browser compatibility issues. The browsers pre-installed in the image are specifically built for that Playwright version.
94+
95+
:::
96+
97+
### Alternative approach: Using asterisk `*`
98+
99+
You can also use asterisk `*` as the automation library version in your `package.json`:
100+
101+
```dockerfile
102+
FROM apify/actor-node-playwright-chrome:22
80103
```
81104

82105
```json
@@ -88,6 +111,25 @@ FROM apify/actor-node-playwright-chrome:20
88111
}
89112
```
90113

114+
This makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. However, this approach is less predictable because you'll get whatever version was latest when the Docker image was built.
115+
116+
## Finding available tags
117+
118+
To see all available tags for each image, you can visit Docker Hub directly:
119+
120+
- [apify/actor-node](https://hub.docker.com/r/apify/actor-node/tags)
121+
- [apify/actor-node-puppeteer-chrome](https://hub.docker.com/r/apify/actor-node-puppeteer-chrome/tags)
122+
- [apify/actor-node-playwright](https://hub.docker.com/r/apify/actor-node-playwright/tags)
123+
- [apify/actor-node-playwright-chrome](https://hub.docker.com/r/apify/actor-node-playwright-chrome/tags)
124+
- [apify/actor-node-playwright-firefox](https://hub.docker.com/r/apify/actor-node-playwright-firefox/tags)
125+
- [apify/actor-node-playwright-webkit](https://hub.docker.com/r/apify/actor-node-playwright-webkit/tags)
126+
127+
You can also query available tags programmatically:
128+
129+
```bash
130+
curl -s "https://registry.hub.docker.com/v2/repositories/apify/actor-node-playwright-chrome/tags?page_size=50" | jq '.results[].name'
131+
```
132+
91133
### Warning about image size
92134

93135
Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need.

0 commit comments

Comments
 (0)