admin管理员组文章数量:1306981
I am trying to install NetBox using Docker Compose following the official repository: NetBox Docker.
The quickstart guide suggests adding a docker-compose.override.yml with the following configuration:
The quickstart guide suggests adding a docker-compose.override.yml with the following configuration:
services:
netbox:
ports:
- "8000:8080"
I followed this method, and it works fine.
However, I want to define the port mapping directly in docker-compose.yml instead of using an override file. I attempted to add the ports section under servicesbox in docker-compose.yml, but it is not working.
Here’s the relevant part of my docker-compose.yml:
services:
netbox: &netbox
image: docker.io/netboxcommunity/netbox:${VERSION-v4.2-3.1.1}
depends_on:
- postgres
- redis
- redis-cache
env_file: env/netbox.env
user: "unit:root"
healthcheck:
test: curl -f http://localhost:8080/login/ || exit 1
start_period: 90s
timeout: 3s
interval: 15s
ports:
- 8000:8080
volumes:
- ./configuration:/etc/netbox/config:z,ro
- netbox-media-files:/opt/netbox/netbox/media:rw
- netbox-reports-files:/opt/netbox/netbox/reports:rw
- netbox-scripts-files:/opt/netbox/netbox/scripts:rw
After running docker-compose up, the NetBox container starts, but I am unable to access it via http://localhost:8000. It seems like the port mapping is not applied.
Questions: Is there a specific reason why port mapping works in docker-compose.override.yml but not in docker-compose.yml? Am I missing any required configuration in docker-compose.yml to make this work? Any help would be appreciated!
本文标签: How to Set Port Mapping Directly in dockercomposeymlStack Overflow
版权声明:本文标题:How to Set Port Mapping Directly in docker-compose.yml? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741820724a2399347.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论