# Linking containers

**URL:** <https://meta.discourse.org/t/linking-containers/13694>\
**Category:** Self-hosting\
**Tags:** hosting\
**Created:** [13 مارس 2014، 2:22م UTC](https://meta.discourse.org/t/linking-containers/13694 "2014-03-13T14:22:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [13 مارس 2014، 11:26م UTC](https://meta.discourse.org/t/linking-containers/13694/2 "2014-03-13T23:26:52Z")

</div>

What you do is expose the port on the host, then you can easily connect to it from any container.

The “expose” section in the yml takes care of it:

```plaintext
expose:
  - "5432:5432"
  - "6379:6379"
  - "2221:22"

```

Then all you need to do is plug in local machine ip here:

> <https://github.com/discourse/discourse_docker/blob/master/samples/web_only.yml#L19-L26>

---

_[View the full topic](https://meta.discourse.org/t/linking-containers/13694)._
