Skip to main content
July 12, 2025
Solved

How to Use 1Password Connect with Docker Compose workloads?

  • July 12, 2025
  • 1 reply
  • 909 views

I can't find a guide on how do I integrate 1Password Connect server (that I deployed in kubernetes) with docker compose workload.

Something as simple as not hardcoding passwords `POSTGRES_PASSWORD: "op://stuff/pgdb/password"` . I know there are `op run/inject/read` but these are a part of Connect.

Best answer by

Hi @PingLoss2 ,

Thanks for writing in. The key to this is the 1Password CLI running on the machine that executes the "docker compose up" command.  You'll need to install the CLI and configure it to work with Connect. Here is a guide on that - https://developer.1password.com/docs/connect/cli

Next up will be the coordination of launching docker compose with the prefilled credentials inserted by 1Password.  Here's an example dockerfile

version: "3.8"
services:
  database:
    image: postgres:16
    environment:
      POSTGRES_USER: "op://my-vault/pgdb/username"
      POSTGRES_PASSWORD: "op://my-vault/pgdb/password"
    ports:
      - "5432:5432"

You'll see the POSTGRES credentials using the 1Password reference.  

Next will be the starting of Docker Compose

op run -- docker compose up

Then your environment variables will have been loaded in from 1Password's Vault.

Let me know if you have any additional troubles! 

Thanks,

Phil

1 reply

Answer
July 14, 2025

Hi @PingLoss2 ,

Thanks for writing in. The key to this is the 1Password CLI running on the machine that executes the "docker compose up" command.  You'll need to install the CLI and configure it to work with Connect. Here is a guide on that - https://developer.1password.com/docs/connect/cli

Next up will be the coordination of launching docker compose with the prefilled credentials inserted by 1Password.  Here's an example dockerfile

version: "3.8"
services:
  database:
    image: postgres:16
    environment:
      POSTGRES_USER: "op://my-vault/pgdb/username"
      POSTGRES_PASSWORD: "op://my-vault/pgdb/password"
    ports:
      - "5432:5432"

You'll see the POSTGRES credentials using the 1Password reference.  

Next will be the starting of Docker Compose

op run -- docker compose up

Then your environment variables will have been loaded in from 1Password's Vault.

Let me know if you have any additional troubles! 

Thanks,

Phil