Can't ssh to postgres container in multi image mode


I would like to ssh to my Postgres container and not only my primary app container.
How can I do that, CircleCi only offer me one IP on the web interface.

My job :

    resource_class: xlarge
    working_directory: /usr/src/app/
      - image: auchandirect/hive:${CIRCLE_SHA1}
          username: $DOCKER_USER
          password: $DOCKER_PASS
          DB: XX
          DB_USER: X
          DB_PASSWORD: XX

      - image: postgres:10.1
          POSTGRES_DB: XX


You cannot SSH to secondary containers by design. To do so, you’d have to have permissions on the Docker host, but that has access to all customers’ builds, so that’s a no-go. :smiley_cat:

I don’t know the Postgres image, but bear in mind it may not even have a running shell on it, never mind an SSH server - Docker containers often don’t have either.

What do you want to achieve by shelling to the database container? Maybe the problem can be attacked in a different way.


I wanted to get the postgres logs.
I thought the logs from the web interface were just a snapshot at a certain point of a time, in fact they are constantly refreshed. Thx.


Gotcha. Assuming the console output of secondary containers is shown in the UI, perhaps there is a way to redirect the logs to stdout? You have a command key within your images, so you can start up Postgres with whatever options you like.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.