# Can't ssh to postgres container in multi image mode

**URL:** <https://discuss.circleci.com/t/cant-ssh-to-postgres-container-in-multi-image-mode/24626>\
**Category:** Databases\
**Created:** [August 24, 2018, 3:18pm UTC](https://discuss.circleci.com/t/cant-ssh-to-postgres-container-in-multi-image-mode/24626 "2018-08-24T15:18:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmolina](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jmolina](https://discuss.circleci.com/u/jmolina)\
**Post date:** [August 24, 2018, 3:18pm UTC](https://discuss.circleci.com/t/cant-ssh-to-postgres-container-in-multi-image-mode/24626/1 "2018-08-24T15:18:09Z")

</div>

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.

 ![38](https://global.discourse-cdn.com/circleci/original/3X/0/6/068be4da7342bd768cc37de57b3207e4c324d538.png)

My job :

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

      - image: postgres:10.1
        environment:
          POSTGRES_USER: XX
          POSTGRES_DB: XX
          POSTGRES_PASSWORD: XX
```

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [August 24, 2018, 4:08pm UTC](https://discuss.circleci.com/t/cant-ssh-to-postgres-container-in-multi-image-mode/24626/2 "2018-08-24T16:08:35Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![jmolina](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jmolina](https://discuss.circleci.com/u/jmolina)\
**Post date:** [August 27, 2018, 8:55am UTC](https://discuss.circleci.com/t/cant-ssh-to-postgres-container-in-multi-image-mode/24626/3 "2018-08-27T08:55:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [August 27, 2018, 9:03am UTC](https://discuss.circleci.com/t/cant-ssh-to-postgres-container-in-multi-image-mode/24626/4 "2018-08-27T09:03:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [November 25, 2018, 9:04am UTC](https://discuss.circleci.com/t/cant-ssh-to-postgres-container-in-multi-image-mode/24626/5 "2018-11-25T09:04:06Z")

</div>

Closed on November 25, 2018, 9:04am UTC

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