“podman compose up” 监听端口 8080。

huangapple go评论86阅读模式
英文:

podman compose up listens to port 8080

问题

我在Linux服务器(RHEL8.6)上安装了docker-composepodman-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 &lt;host port&gt;:&lt;container port&gt;.

huangapple
  • 本文由 发表于 2023年6月6日 16:29:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76412772.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定