
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
, but will still be served until a new tile has been rendered, or deleted from the cache (DELETEFROM), so nothing will be served until a new tile has been rendered.
The example tile expiration values below are the default values.
docker run \ -p 8080:80 \ -e REPLICATION_URL=https://planet.openstreetmap.org/replication/minute/ \ -e MAX_INTERVAL_SECONDS=60 \ -e UPDATES=enabled \ -e EXPIRY_MINZOOM=13 \ -e EXPIRY_TOUCHFROM=13 \ -e EXPIRY_DELETEFROM=19 \ -e EXPIRY_MAXZOOM=20 \ -v osm-data:/data/database/ \ -v osm-tiles:/data/tiles/ \ -d overv/openstreetmap-tile-server \ run
To enable the Access-Control-Allow-Origin header to be able to retrieve tiles from other domains, simply set the ALLOW_CORS variable to enabled:
docker run \ -p 8080:80 \ -v osm-data:/data/database/ \ -e ALLOW_CORS=enabled \ -d overv/openstreetmap-tile-server \ run
To connect to the PostgreSQL database inside the container, make sure to expose port 5432:
docker run \ -p 8080:80 \ -p 5432:5432 \ -v osm-data:/data/database/ \ -d overv/openstreetmap-tile-server \ run
Use the user renderer and the database gis to connect.
psql -h localhost -U renderer gis
The default password is renderer, but it can be changed using the PGPASSWORD environment variable:
docker run \ -p 8080:80 \ -p 5432:5432 \ -e PGPASSWORD=secret \ -v osm-data:/data/database/ \ -d overv/openstreetmap-tile-server \ run
Details for update procedure and invoked scripts can be found here https://ircama.github.io/osm-carto-tutorials/updating-data/.
The import and tile serving processes use 4 threads by default, but this number can be changed by setting the THREADS environment variable. For example:
docker run \ -p 8080:80 \ -e THREADS=24 \ -v osm-data:/data/database/ \ -d overv/openstreetmap-tile-server \ run
The import and tile serving processes use 800 MB RAM cache by default, but this number can be changed by option -C. For example:
docker run \ -p 8080:80 \ -e "OSM2PGSQL_EXTRA_ARGS=-C 4096" \ -v osm-data:/data/database/ \ -d overv/openstreetmap-tile-server \ run
The database use the autovacuum feature by default. This behavior can be changed with AUTOVACUUM environment variable. For example:
docker run \ -p 8080:80 \ -e AUTOVACUUM=off \ -v osm-data:/data/database/ \ -d overv/openstreetmap-tile-server \ run
If you are planning to import the entire planet or you are running into memory errors then you may want to enable the --flat-nodes option for osm2pgsql. You can then use it during the import process as follows:
docker run \ -v /absolute/path/to/luxembourg.osm.pbf:/data/region.osm.pbf \ -v osm-data:/data/database/ \ -e "FLAT_NODES=enabled" \ overv/openstreetmap-tile-server \ import
Warning: enabling FLAT_NOTES together with UPDATES only works for entire planet imports (without a .poly file). Otherwise this will break the automatic update script. This is because trimming the differential updates to the specific regions currently isn't supported when using flat nodes.
You can find an example of the import performance to expect with this image on the OpenStreetMap wiki.
If you encounter such entries in the log, it will mean that the default shared memory limit (64 MB) is too low for the container and it should be raised:
renderd[121]: ERROR: failed to render TILE default 2 0-3 0-3 renderd[121]: reason: Postgis Plugin: ERROR: could not resize shared memory segment "/PostgreSQL.790133961" to 12615680 bytes: ### No space left on device
To raise it use --shm-size parameter. For example:
docker run \ -p 8080:80 \ -v osm-data:/data/database/ \ --shm-size="192m" \ -d overv/openstreetmap-tile-server \ run
For too high values you may notice excessive CPU load and memory usage. It might be that you will have to experimentally find the best values for yourself.
You may be running into problems with memory usage during the import. Have a look at the "Flat nodes" section in this README.
Copyright 2019 Alexander Overvoorde Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务