Skip to content

Instantly share code, notes, and snippets.

@amit08255
Created October 18, 2022 17:08
Show Gist options
  • Save amit08255/154ea640f9393b09a5f36b9305ab8d60 to your computer and use it in GitHub Desktop.
Save amit08255/154ea640f9393b09a5f36b9305ab8d60 to your computer and use it in GitHub Desktop.
Docker CheatSheet

Docker CheatSheet

Connect to postgreSQL using terminal

Docker compose example with postgreSQL:

version: "3"
services:
  # Postgres
  postgres:
    image: postgres:latest
    ports:
      # Accessible from the host at port :35432
      - "35432:5432"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: saas
    # Make sure log colors show up correctly
    tty: true

Connect to your container from the host:

docker exec -it myproject_pg_container_name /bin/bash

Then, from the container:

root@d14c082e80c8:/# psql -U postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment