Skip to content

Docker: many users, many environments

One Docker stack can serve several people working on several Teradata systems (environments). Each person opens the same address, chooses an environment, logs in with their own database account, and gets an app process of their own. This page is the short path from nothing to a running stack and to its day-to-day operation. The reference for every option is Docker with a login page.

1. What you get

 browser (jane)  ─┐
 browser (paul)  ─┼─►  gateway :8000  ──  login page, environments, sessions
 program (/v1)   ─┘          │
                             ├─ worker  jane @ Production ──►  Teradata (Production)
                             ├─ worker  jane @ Laboratory ──►  Teradata (Laboratory)
                             └─ worker  paul @ Production ──►  Teradata (Production)
                             │
                             └─ chroma  (vector index server, shared, no published port)
  • The gateway is the entry point of the image. It shows the login page, checks the credentials against the chosen system, then starts one worker process per person and environment and forwards that person's requests to it.
  • Why one process per person and environment: an app process holds one database connection and its settings. Two people, or one person on two systems, in one process would overwrite each other.
  • The database applies their own rights. The password is checked by the database, handed to the worker through its process environment (never a command-line argument, never in the logs) and not stored, unless the person ticks Remember my credentials (see section 5).

2. Prerequisites

  • Docker Desktop (Windows or macOS, engine running) or Docker Engine with the compose plugin on a Linux server.
  • Port 8000 free on the machine (TDFS4DS_SERVE_PORT in .env changes it).
  • A network path from that machine to each Teradata system (VPN where needed; the container uses the host's network). The generator tests TCP port 1025 of each host and only warns.
  • A feature store (tdfs4ds.setup()) on each environment you offer.
  • For chat answers, an instruct model (and an embedding model for search). The app works without them.

3. One call: create_docker_deployment

Run it from a Python session where the models, vector store and store are already configured: the folder copies those settings. No database password is ever written.

import tdfs4ds

rep = tdfs4ds.create_docker_deployment(
    "tdfs4ds-docker",                      # folder; also the stack's name in Docker Desktop
    environments=[
        {"id": "prod", "label": "Production", "host": "teradata-prod.example.com",
         "logmechs": ["LDAP", "TD2"], "encrypt": True, "database": "FS_PROD"},
        {"id": "lab", "label": "Laboratory", "host": "teradata-lab.example.com",
         "logmechs": ["TD2"], "encrypt": True, "database": "FS_LAB",
         "databases_readonly": ["FS_PROD"]},
    ],
    min_profile=None,                      # 'analyst'|'scientist'|'engineer'|'admin': a floor for everybody
    source="pypi",                         # 'wheel' (version not on PyPI yet) or 'checkout'
    port=8000,
    prompt=False,                          # True asks the missing pieces
    include_secrets=False,                 # model keys stay placeholders unless you consent
)
print(rep["problems"], rep["warnings"], rep["missing"])
Parameter Meaning
path the folder to create (default tdfs4ds-docker)
environments list of environment entries (below); the running session's connection is added first
remembered a state/environments.json whose environments are merged in
include_secrets 'ask' (default), True, False: whether model/Vector Store keys of the session go into .env
source, version, wheel how the image gets tdfs4ds: PyPI at that version, a wheel copied into the folder, or the checkout
port port published on 127.0.0.1
chroma 'server' (a Chroma container shared by every worker) or 'local' (files in /data)
min_profile written on every environment that has none: everybody gets at least this profile
prompt, check, overwrite, force ask questions; check hosts and docker compose config; replace files (an existing .env is patched); write despite a problem

From a terminal: python -m tdfs4ds.deployment tdfs4ds-docker --source pypi.

The folder contains docker-compose.yml, Dockerfile, .env (generated TDFS4DS_SERVE_SECRET included), config/environments.yaml, an empty state/, README.md, start.ps1 and start.sh. Keep it somewhere permanent: ./config and ./state are read from it at every start.

4. The environments file

config/environments.yaml (or .json) is yours and read only for the app. It never holds a password.

environments:
  - id: prod                        # unique: letters, digits, - and _
    label: Production               # shown on the login page
    host: teradata-prod.example.com
    logmechs: [LDAP, TD2]           # TD2, LDAP, TDNEGO, JWT; the first is the default
    encrypt: true
    database: FS_PROD               # the feature store opened after the login
    databases_readonly: [FS_LAB]    # other stores attached read-only
    min_profile: analyst            # optional floor: analyst | scientist | engineer | admin
    env:                            # other TDFS4DS_* settings of this environment, never a secret
      DATA_DOMAIN: SALES
  - id: lab
    label: Laboratory
    host: teradata-lab.example.com
    logmechs: [TD2]

Other keys: chroma (server or local), and api_key_var, service_user_var, service_password_var (names of variables of .env, for programs calling /v1). An error in the file (duplicate id, missing host, unknown key, a secret under env:) stops the gateway at start and lists every problem.

Remembered environments. The list on the login page ends with New environment...: a person types a name, host, logon mechanism, encryption and store database. After a successful logon the entry is saved in state/environments.json (host and options, who added it and when; never a password). You can read, edit, back up or copy that file; an edit applies without a restart. An administrator can remove a saved entry from the login page. TDFS4DS_SERVE_ALLOW_NEW_ENVIRONMENT=false keeps the choice to the listed environments.

5. First start and the login window

cd tdfs4ds-docker
.\start.ps1            # Windows: finds docker.exe, builds, starts, waits for /health, opens the browser
.\start.ps1 -NoBrowser # do not open the page
.\start.ps1 -Check     # also tests port 1025 of every environment from inside the container
cd tdfs4ds-docker && ./start.sh        # Linux / macOS (--check)

The first build takes about 4 minutes (the image is about 2.7 GB); later starts take seconds. Open http://localhost:8000.

The tdfs4ds login window: environment, logon mechanism, user, password, remember checkbox and the Log in button

Field What it does
Environment the Teradata system (the list of section 4); the last one you used is preselected
Logon mechanism one of the logmechs of that environment (TD2, LDAP, TDNEGO, JWT)
User / Password your own database account. A JWT logon asks for the token instead
Remember my credentials for this environment unchecked by default; see below

The environment list opened: Production, Laboratory, New environment...

(The list is a native drop-down; the screenshot shows it expanded.)

Remember my credentials is opt-in, for TD2 and LDAP only. The password is encrypted (AES-256-GCM) in the tdfs4ds_secrets volume; the key lives in an HttpOnly cookie of that browser, so neither half works alone. A JWT token is never stored. The entry lasts 30 days from last use (TDFS4DS_SERVE_REMEMBER_DAYS), is deleted if the database refuses it, and is removed by Forget my credentials. Do not tick it on a shared computer; TDFS4DS_SERVE_REMEMBER_CREDENTIALS=false removes the option for everyone.

After a successful login the first page opens in about 20 seconds (that person's worker connects); then it is the normal app.

6. Profiles come from the person's Teradata roles

Profile (what the app offers) Teradata role that grants it Setting that renames the role
analyst: chat, catalogs, lineage none (the default)
scientist: runs, health check TDFS4DS_SCIENTIST TDFS4DS_SERVE_ROLE_SCIENTIST
engineer: maintenance, migration, removal, documentation edits TDFS4DS_ENGINEER TDFS4DS_SERVE_ROLE_ENGINEER
admin: Parameters, Assistant settings, evaluation TDFS4DS_ADMIN TDFS4DS_SERVE_ROLE_ADMIN

The roles are read on the person's own logon. min_profile (per environment, or TDFS4DS_SERVE_MIN_PROFILE in .env for all) is a floor: a personal computer typically uses admin; a role can still grant a higher profile than the floor.

A profile is not a permission

The profile only decides which pages and actions the app offers. What a person can read or change is always decided by Teradata, for the account they logged on with.

7. Operating it

Want Do
Stop, keep everything Stop in Docker Desktop (the group named after the folder), or docker compose stop
Start again the group's Start button, or docker compose start
Logs docker compose logs -f tdfs4ds (worker lines are masked)
Add an environment edit config/environments.yaml, then docker compose restart tdfs4ds; or let people use New environment... (saved in state/, no restart)
Update to a new tdfs4ds tdfs4ds.create_docker_deployment("tdfs4ds-docker", source="pypi", overwrite=True, prompt=False) (or source="wheel" with a freshly built wheel), then .\start.ps1 rebuilds. .env is patched, state/ untouched
Remove containers, keep data docker compose down
Remove everything, data too docker compose down -v (deletes the vector index and remembered credentials; config/ and state/ stay on disk)

Where the data lives:

Data Where
Your environments ./config (mounted at /config, read only)
Environments saved from the login page ./state (mounted at /state)
Remembered credentials, model keys saved in the app (encrypted) volume tdfs4ds_secrets
Vector index volume chroma_data (the chroma service); each environment has its own collection prefix tdfs4ds_<environment id>
Worker files volume tdfs4ds_data (/data)

Limits: TDFS4DS_SERVE_MAX_WORKERS (default 8; a worker uses roughly 300 to 500 MB), a login lasts 30 minutes of inactivity (TDFS4DS_SERVE_SESSION_TTL) and 480 minutes at most (TDFS4DS_SERVE_SESSION_MAX). After a restart of the stack people log in again. Reverse-proxy prefix: set TDFS4DS_SERVE_ROOT_PATH (see the API server page).

Programs calling the assistant use Authorization: Bearer <key> on /v1 (or /env/<id>/v1/chat/completions); see Programs calling the agent.

8. Security notes

  • The page is published on 127.0.0.1 only. To open it to colleagues, put a reverse proxy with HTTPS in front (the password crosses the network at login), set TDFS4DS_SERVE_COOKIE_SECURE=true, and TDFS4DS_SERVE_TRUST_PROXY=true only behind a proxy you control; then change the port line of docker-compose.yml.
  • Keep TDFS4DS_SERVE_SECRET stable: it signs the cookies and derives the key that encrypts the model keys saved in the app. The generated .env carries one; do not commit .env.
  • Credentials exist only in the worker's process environment, unless the person opted in to remember them.
  • Rate limit on failed logins (5 in 5 minutes per address and per user) and the audit logger are those of the login gate.
  • Opening a stack to other people also lets them reach every host the container can reach. Set TDFS4DS_SERVE_ALLOW_NEW_ENVIRONMENT=false where that is not acceptable.

9. Troubleshooting

Symptom Cause Action
"Docker was not found" / the engine does not answer Docker Desktop not installed or not started start it and wait for "Engine running" (on Windows docker.exe is in %LOCALAPPDATA%\Programs\DockerDesktop\resources\bin; start.ps1 looks there)
port is already allocated something uses 8000 stop it, or TDFS4DS_SERVE_PORT=8001 in .env
Login: refused (401), Teradata error 8017 wrong credentials, or this logon mechanism is not accepted on that system try another mechanism of the environment; a JWT must be a database token
Login: unreachable (503) no network path (VPN, system stopped) .\start.ps1 -Check; trial systems stop by themselves
Error 3007 / too many sessions a worker per person and environment each hold a session log out when done; lower TDFS4DS_SERVE_MAX_WORKERS; ask the DBA for more sessions (cause not measured here)
"server is full" TDFS4DS_SERVE_MAX_WORKERS reached log someone out, or raise it and Docker Desktop's memory
Only business pages, no Parameters profile analyst (no database roles) min_profile or the TDFS4DS_* roles (section 6)
Chat says nothing, "No API key" no model or key set them in Parameters (admin), or in .env then docker compose up -d
Page stopped after a while inactivity limit, or a worker died log in again
Gateway fails at start after editing config/ environments file error docker compose logs tdfs4ds names the file and the problem

Not verified here

The login page and the file formats were checked against the code and a gateway started locally with two placeholder environments. A logon through the container against a real system, the role-to-profile mapping on a real system, and the 3007 cause above were not exercised for this page.

See also: Docker with a login page (every option), Login gate, the fs-docker skill.