# Utilisez plusieurs conteneurs Docker sans exposer de ports

**URL:** <https://meta.discourse.org/t/use-multiple-docker-containers-without-exposing-ports/22283>\
**Category:** Sysadmins\
**Tags:** docker, how-to, advanced-setup\
**Created:** [Novembre 18, 2014, 9:43 UTC](https://meta.discourse.org/t/use-multiple-docker-containers-without-exposing-ports/22283 "2014-11-18T21:43:13Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)\
**Post date:** [Mars 15, 2015, 12:06 UTC](https://meta.discourse.org/t/use-multiple-docker-containers-without-exposing-ports/22283/6 "2015-03-15T12:06:54Z")

</div>

If you’d like to have separate redis and postgres containers you will need to omit the `2221` part of that expose section to be able to ssh into both containers.

You can use dynamic port allocation with docker like this:

Postgres container:

```
expose:
# - "5432:5432"
  - "127.0.0.1::22"

```

Redis container:

```
expose:
# - "6379:6379"
  - "127.0.0.1::22"

```

A helpful page on this can be found [here](https://docs.docker.com/userguide/dockerlinks/)

I just thought I would document this here as this is a page I’ve kept coming back to whilst setting up multiple containers.

Thanks for the original topic @jspdng

---

_[View the full topic](https://meta.discourse.org/t/use-multiple-docker-containers-without-exposing-ports/22283)._
