Skip to content

cannot connect to Postgres Pro database in Azure Container #20126

@alexeyshishkin01

Description

@alexeyshishkin01

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug
I have the following yaml-file to create Azure Container:

name: debiandocker
apiVersion: 2019-12-01
location: northeurope
tags: {}
properties:
containers:

  • name: debiandocker
    properties:
    image: XXX/pgpro-ent13-debian-x64:13.41.20211031
    ports:
    • protocol: tcp
      port: 5533
      environmentVariables:
    • name: PGPRO_SUPERUSER_PASSWORD
      value: azure
    • name: PGPRO_PORT
      value: 5533
      resources:
      requests:
      memoryInGB: 1
      cpu: 1
      imageRegistryCredentials:
  • server: XXX
    username: YYY
    password: ZZZ
    ipAddress:
    ports:
    • protocol: tcp
      port: 5533
      type: Public
      osType: Linux

If I specify the same value for both 'port:' and 'PGPRO_PORT' (say '5533 as in example above) I can create Azure Container and can connect to Postgres Pro database via 'psql' in Azure Container outside of it:

root@ubuntu20:~/docker# psql --dbname=postgres --username=postgres --host=$fqdn_id --port=5533 -c "select pgpro_version()"
Password for user postgres:

But if I use different value for 'port:' and 'PGPRO_PORT' (see example below) I can create Azure Container and cannot connect to Postgres Pro database vias 'psql' in Azure Container outside of it:

root@ubuntu20:~/docker# psql --dbname=postgres --username=postgres --host=$fqdn_id --port=5534 -c "select pgpro_version()"
psql: error: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

name: debiandocker
apiVersion: 2019-12-01
location: northeurope
tags: {}
properties:
containers:

  • name: debiandocker
    properties:
    image: XXX/pgpro-ent13-debian-x64:13.41.20211031
    ports:
    • protocol: tcp
      port: 5534
      environmentVariables:
    • name: PGPRO_SUPERUSER_PASSWORD
      value: azure
    • name: PGPRO_PORT
      value: 5533
      resources:
      requests:
      memoryInGB: 1
      cpu: 1
      imageRegistryCredentials:
  • server: XXX
    username: YYY
    password: ZZZ
    ipAddress:
    ports:
    • protocol: tcp
      port: 5534
      type: Public
      osType: Linux

In the latter case I can connect to Azure Container via

az container exec
--resource-group ABC
--name debiandocker
--exec-command "/bin/bash"
--container-name debiandocker

and make sure Postgres Pro database is up and running and it listens on the specified 5533 tcp-port, I can connect to Postgres Pro database via 'psql' only inside of Azure Container.

To Reproduce
see above

Expected behavior
to be able to use different values for 'port:' and 'PGPRO_PORT', i.e. for external and internal ports

Environment summary
root@ubuntu20:~/docker# az version
Azure-cli Azure-cli-core Azure-cli-telemetry


2.29.2 2.29.2 1.0.6
root@ubuntu20:~/docker# az --version
azure-cli 2.29.2
core 2.29.2
telemetry 1.0.6

Additional context
No issue with native docker container (native docker-compose)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions