英文:
podman compose up listens to port 8080
问题
我在Linux服务器(RHEL8.6)上安装了docker-compose
和podman-compose
。我在目录中有docker-compose.yaml
文件,内容如下:
version: '3'
services:
serviceA:
image: 'AA/XXX:XX.XX.XX'
ports:
- "8081:8081"
restart: 'always'
working_dir: /var/serviceA
environment:
TZ: "Europe/Berlin"
volumes:
- /var/serviceA:/var/serviceA
- ${JAVA_HOME}/lib/security/cacerts:/etc/ssl/certs/java/cacerts
我运行了podman-compose up -d
,并看到容器正在运行。但是,我无法通过https://localhost:8081
访问它。
所以当我运行podman-compose up
时,我看到它显示以下日志:
Listening on http://localhost:8080
为什么Podman不使用我在Compose文件中指定的端口?我漏掉了什么吗?
英文:
I have docker-compose
and podman-compose
installed on the linux server (RHEL8.6)
I have the docker-compose.yaml file in the directory, which is as shown :
version: '3'
services:
serviceA:
image: 'AA/XXX:XX.XX.XX'
ports:
- "8081:8081"
restart: 'always'
working_dir: /var/serviceA
environment:
TZ: "Europe/Berlin"
volumes:
- /var/serviceA:/var/serviceA
- ${JAVA_HOME}/lib/security/cacerts:/etc/ssl/certs/java/cacerts
I run the podman-compose up -d
and see that the container is running. However I cannot access it via https://localhost:8081
So when I do a podman-compose up
, I see that it shows the following log:
Listening on http://localhost:8080
Why is it that podman does not take the port I specify on the compose file? Anything I am missing here?
答案1
得分: 3
那个Listening on http://localhost:8080
消息来自容器内运行的应用程序。Podman负责映射主机端口到容器端口。
如果您想在主机端口8081上公开容器化的服务,您需要编写:
services:
serviceA:
ports:
- 8081:8080
在ports
列表中的条目语法是<主机端口>:<容器端口>
。
英文:
That Listening on http://localhost:8080
messages comes from the application running inside the container. Podman takes care of mapping a host port to the container port.
If you want to expose the containerized service on host port 8081, you would need to write:
services:
serviceA:
ports:
- 8081:8080
The syntax of entries in the ports
list is <host port>:<container port>
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论