Use multiple Docker containers without exposing ports

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”

:smile:

7 Likes