# Use multiple Docker containers without exposing ports

**URL:** <https://meta.discourse.org/t/use-multiple-docker-containers-without-exposing-ports/22283>\
**Category:** Sysadmins\
**Tags:** docker, how-to, advanced-setup\
**Created:** [November 18, 2014, 9:43pm 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:** 2

<div class="post-metadata">

**Author:** ![jspdng](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@jspdng](https://meta.discourse.org/u/jspdng)\
**Post date:** [November 18, 2014, 9:45pm UTC](https://meta.discourse.org/t/use-multiple-docker-containers-without-exposing-ports/22283/2 "2014-11-18T21:45:22Z")

</div>

Additionally, you can expose ports to **localhost only**. This way you can still connect to the data container via SSH but only from your server (again, without exposing the database to the internet).

**How to:**

1. Edit your `data.yml` file adding the localhost on the `expose` section for port 22:

> expose:  
> # - “5432:5432”  
> # - “6379:6379”
> 
> - “127.0.0.1:2221:22”

😄

---

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