2

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?

larsks
  • 277,717
  • 41
  • 399
  • 399
RCB
  • 479
  • 1
  • 9

1 Answers1

3

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>.

larsks
  • 277,717
  • 41
  • 399
  • 399