'Docker container can't download WordPress installation files automatically
I have the following compose file:
version: "3"
services:
wordpress:
image: visiblevc/wordpress
privileged: true
network_mode: bridge #should help?
# required for mounting bindfs
cap_add:
- SYS_ADMIN
devices:
- /dev/fuse
# required on certain cloud hosts
security_opt:
- apparmor:unconfined
ports:
- 8080:80
- 8081:443
...WP parameters ommitted for brewity
When I run it, I get the following error:
When I use the CLI and curl the SAME url, I can download the information.
What should I change in the yaml to make it work automatically?
UPDATE:
As curl works manually, I don't think it as a DNS resolve error, but to make sure, I modified the resolv.conf file to a valid nameserver address:
Unfortunately, it didn't solve the issue.
Solution 1:[1]
Try to put on image this:
image: visiblevc/wordpress:latest
You need to specify the tag.
Solution 2:[2]
We checked the initialization shell script of the Docker image.
We couldn't determine why the resolve fails when wp core download was called so we created a workaround.
We added a pre-init section inside the script to use the explicit curl commands that worked as demonstrated in the CLI. As a sideeffect, we download the necessary files so it bypasses the need of downloading and the potential resolve timeout. Note: we needed several curl calls for the API as the resolve kept failing after only one call.
This is how the new script starts:
h1 Pre-init
curl "https://api.wordpress.org/core/version-check/1.7/?locale=en_US" >/dev/null
curl "https://downloads.wordpress.org/release/wordpress-5.9.3.zip" --output wordpress-5.9.3.zip
curl "https://api.wordpress.org/core/version-check/1.7/?locale=en_US" >/dev/null
curl "https://downloads.wordpress.org/plugin/classic-editor.1.6.2.zip" --output classic-editor.1.6.2.zip
curl "https://downloads.wordpress.org/translation/core/5.9.3/hu_HU.zip" --output hu_HU.zip
curl "https://api.wordpress.org/core/version-check/1.7/?locale=en_US" >/dev/null
h1 'Begin WordPress Installation'
Using this script, the installation succeeded.
Solution 3:[3]
Here's the code I used for the AR QuickLook
class ARQLViewController: UIViewController, QLPreviewControllerDataSource {
let assetName = "Pantone"
let assetType = "usdz"
let allowsContentScaling = false
let canonicalWebPageURL = URL(string: "nil")
override func viewDidAppear(_ animated: Bool) {
let previewController = QLPreviewController()
previewController.dataSource = self
present(previewController, animated: true, completion: nil)
}
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
return 1
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
guard let path = Bundle.main.path(forResource: assetName, ofType: assetType) else {
fatalError("Couldn't find the supported asset file.")
}
let url = URL(fileURLWithPath: path)
let previewItem = ARQuickLookPreviewItem(fileAt: url)
previewItem.allowsContentScaling = allowsContentScaling // default = true
previewItem.canonicalWebPageURL = canonicalWebPageURL // default = nil
return previewItem
}}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | euTIMER |
| Solution 2 | Nestor |
| Solution 3 | EliottSt |



