Run an application
dopbase run starts a child process with secrets from one explicit environment.
Use -- to separate Dopbase arguments from the application command:
dopbase run payment-service/development -- npm run devThe same pattern works with other commands:
dopbase run payment-service/development -- cargo run
dopbase run env_482731 -- python app.pyThe environment may be an immutable env_... ID or a readable project/environment reference. An environment already belongs to one project, so no active project selection is needed.
Run a shell command
After --, your command goes to the program as typed. Your own shell reads the line first, so $API_TOKEN in an argument is replaced before Dopbase has loaded anything, usually with nothing. && and | are also handled by your shell, not by the command.
Pass the whole command as one string with --command, or -c, instead. Dopbase loads the secrets and then runs the string in a shell that has them:
dopbase run payment-service/development --command 'curl -H "Authorization: Bearer $API_TOKEN" https://api.internal/health'
dopbase run payment-service/production -c 'npm run migrate && npm start'Use single quotes. In double quotes your shell expands $API_TOKEN before Dopbase starts, and the command gets an empty value.
The string runs in the shell that SHELL names when that is bash, dash, zsh, fish, ksh, csh or tcsh. Otherwise it runs in sh, which is also what happens in most CI jobs and containers, where SHELL isn't set. The run banner names the shell, as in shell=zsh. A stored secret called SHELL reaches the command like any other secret but never picks the shell. Dopbase never prints the string, because it can hold a token you typed in.
The shell isn't interactive, so it skips .zshrc and .bashrc, and aliases or functions defined there don't exist in the string. zsh still reads ~/.zshenv. Programs on your PATH work, including interactive ones such as ssh or claude: they get your terminal, its size and what you type.
--command can't be combined with a command after --. dopbase run exits with the shell's exit code, which is the exit code of the last command it ran.
A stop has to reach every step of a string such as npm run migrate && npm start, and not only the shell that runs them. In your terminal, Ctrl-C already does that. With no terminal, as in CI, systemd, Kubernetes or docker without -t, Dopbase stays running as the parent, gives the command a process group of its own, and sends every stop, hang-up, interrupt or quit it receives to that whole group. A kill <pid> from another terminal tab, or on a run started with &, still reaches only the shell. Stop such a job with kill %1 from the shell that started it, which signals the whole job.
With --mount, read the file's path from the variable, as "$SSH_PRIVATE" or "${SSH_PRIVATE}". {KEY} is only replaced in arguments after --, so a bare {SSH_PRIVATE} in a --command string stops the run before anything starts:
dopbase run ops/production --mount SSH_PRIVATE -c 'ssh -i "$SSH_PRIVATE" root@203.0.113.10 uptime && echo done'{KEY} in an argument is a file path on your machine. ${KEY} inside a secret's value is something else: a secret reference, filled in on the server.
Deployment configuration
Application servers should use a runner token. A runner token belongs to one environment, so dopbase run uses that environment and needs no reference:
export DOPBASE_URL=https://dopbase.example.com
printf '%s' "$RUNNER_TOKEN" | dopbase login --token
dopbase run -- ./payment-serviceThis stores one encrypted credential for the selected server. Saving another human login or runner token replaces it. CI systems can set DOPBASE_TOKEN instead:
# The pipeline injects DOPBASE_TOKEN from its secret store.
dopbase run -- ./payment-serviceCredential priority is DOPBASE_TOKEN, then the saved credential. A saved runner token works for a persistent server; an injected token works for a CI job without writing local credentials.
You can still name the environment, as in dopbase run env_482731 -- ./payment-service. With a runner token the reference only checks the token. If it names another environment, run stops before the application starts and before the server reads any value:
Error: The runner token cannot access payment-service/staging. Drop the environment reference to run the token's own environment, or use a token made for payment-service/staging.DOPBASE_ENV works the same way. A runner token ignores the saved default from dopbase env default, which is for people signed in with their own account.
If a deployment command needs a file, use the same runner credential with dopbase export env_482731 --output .env. Export requires a live server and never uses cached values. See AWS CodeBuild exports for a pipeline example.
dopbase run never opens a login prompt. If no credential is available, it stops and asks you to run dopbase login or set DOPBASE_TOKEN. Invalid, expired, and revoked credentials also stop the command before the application starts.
With a personal login or personal token, the environment can instead come from deployment-time configuration:
export DOPBASE_ENV=env_482731
dopbase run -- ./payment-serviceAn explicit positional environment takes precedence over DOPBASE_ENV. If neither is present, Dopbase uses the server-scoped default saved by:
dopbase env default payment-service/development
dopbase run -- ./payment-serviceIf no matching default exists, Dopbase stops with instructions for setting one. Use dopbase env default --clear to remove it. An empty DOPBASE_ENV is treated as a configuration error rather than falling back.
Use different environment IDs and runner tokens for production and staging. See target projects and environments for a full two-server example.
Data flow
Select the diagram to open the viewer. You can zoom, drag the diagram in any direction, or use the keyboard controls.
The client retrieves the allowed values and injects them into the child process. It does not create a .env file.
Each successful runtime fetch refreshes the latest encrypted cache entry for that environment. If the server cannot be reached, times out, or returns a 5xx response, run uses the matching cache after waiting up to five seconds for the complete live fetch. Authentication, authorization, not-found, and invalid response errors never fall back to cache.
The cache is bound to the normalized server URL and exact session or runner token that populated it. A logout or token rotation therefore makes the old cache unavailable. Cache entries do not expire automatically. An offline run prints the original fetch time and age so operators can judge staleness.
Inspect and maintain the cache without contacting the server:
dopbase cache list
dopbase cache clean --dry-run
dopbase cache clean --older-than 30d --yesCleanup targets entries older than 14 days unless --older-than or --all is passed. The listing and cleanup preview contain runtime metadata only, never secret names or values. See client configuration for cache storage and cleanup details.
Choose which secrets reach the application
By default the child receives every stored secret, and a stored value replaces a variable of the same name inherited from your shell. Two flags change that.
--only limits injection to the keys you name. Repeat the flag or separate keys with commas:
dopbase run payment-service/production --only API_KEY,DATABASE_URL -- npm start
dopbase run payment-service/production --only API_KEY --only DATABASE_URL -- npm startIf a key named by --only is not stored in the environment, Dopbase stops before the application starts and lists the missing names. Pass --allow-missing to start anyway; the missing names are then printed as a warning:
dopbase run payment-service/development --only OPTIONAL_KEY --allow-missing -- npm run dev--preserve-env keeps the value your shell already has for the named keys. A named key your shell does not define still gets the stored secret:
PORT=3001 dopbase run payment-service/development --preserve-env PORT,LOG_LEVEL -- npm run devThere is no option to preserve every inherited variable. Name each key you want to keep.
To check which keys arrived without printing their values, list names only:
dopbase run payment-service/development --only API_KEY -- sh -c 'env | cut -d= -f1'Give a command a file
Some tools only take a path: ssh -i, a Java keystore, a Google service account file. --mount writes a secret to a file for as long as the command runs:
dopbase run ops/production --mount SSH_PRIVATE -- ssh -i {SSH_PRIVATE} root@203.0.113.10For each mounted secret, Dopbase:
- writes the secret to a temporary file only you can read;
- replaces
{SSH_PRIVATE}in the arguments after--with the file's path; - sets the
SSH_PRIVATEvariable to the same path, where it would otherwise hold the content; - deletes the file when the command ends, fails, or is stopped.
Because the variable holds the path, a tool that reads a path from a variable needs no placeholder:
dopbase run payment-service/production --mount GOOGLE_APPLICATION_CREDENTIALS -- node server.jsMount several secrets by repeating the flag or separating keys with commas. Secrets you do not mount are still passed as variables:
dopbase run payment-service/production --mount TLS_CERT,TLS_KEY -- \
curl --cert {TLS_CERT} --key {TLS_KEY} https://api.internalWhat ends up in the file depends on how the secret was stored:
A pasted private key often loses its final line break, and ssh refuses a key file without one. When a plain value starts with -----BEGIN and has no final line break, the mounted file gets one. The stored secret is not changed. Base64 that was pasted by hand is not decoded, because Dopbase cannot tell it from any other text. Upload the file instead.
--mount stops before the command starts when a key is not stored, is left out by --only, or is also named in --preserve-env. A name that loads code must be named in --only as well.
The files live in a folder only you can open. On Linux that is under $XDG_RUNTIME_DIR when it is set, which is memory only. Otherwise, and on macOS, it is your temporary directory, so the file is on disk while the command runs.
A plain dopbase run replaces itself with your command. A mounted run can't, because something has to delete the files afterwards, so Dopbase stays running as the parent, passes the terminal through, forwards a stop signal to the command, and exits with the command's exit code. With no terminal, the signal goes to the command's whole process group, as for --command. If Dopbase itself is killed before it can clean up, the next dopbase run removes what was left.
How --only and --preserve-env differ
--only decides which stored secrets enter the application. --preserve-env decides which value wins when a stored secret and your shell define the same name.
Take an environment that stores API_KEY, DATABASE_URL, and PORT=8080, started from a shell that already has PORT=3001:
With --only API_KEY, the shell's PORT survives because PORT was never selected, and DATABASE_URL does not reach the application at all. With --preserve-env PORT, every secret is still injected and only PORT keeps the shell's value. If the shell had no PORT, the stored 8080 would be used.
The flags work together. --only API_KEY,PORT --preserve-env PORT injects only those two keys and keeps the shell's PORT if it has one.
Reserved names
Some stored names are never injected, even when --only asks for them. Dopbase skips them and prints the skipped names, never their values, to standard error.
- Dopbase control variables:
DOPBASE_TOKEN,DOPBASE_URL,DOPBASE_ENV,DOPBASE_DATA_DIR, andDOPBASE_SECRETS_PATH. A stored secret cannot hand the child a different credential or server. - Shell variables:
PATH,HOME,PS1,PS2, and any name that starts withXDG_orLC_. Replacing them could make the child run a different program or read a different home directory. Doppler and Infisical skip the same names.
Dopbase also removes DOPBASE_TOKEN from the inherited environment, so the application never receives the credential used to fetch its secrets.
Names that load code
Some names make a program load extra code or run extra commands. A stored secret with one of these names could run code inside your application, or in a tool it starts, such as git on a CI runner. Dopbase skips them unless you name them in --only:
- Loaders:
LD_PRELOAD,LD_LIBRARY_PATH,LD_AUDIT,DYLD_INSERT_LIBRARIES,DYLD_LIBRARY_PATH,DYLD_FRAMEWORK_PATH. - Runtimes:
NODE_OPTIONS,NODE_PATH,PERL5OPT,PERL5LIB,PYTHONWARNINGS,PYTHONPATH,RUBYOPT,RUBYLIB,JAVA_TOOL_OPTIONS,JDK_JAVA_OPTIONS,_JAVA_OPTIONS,PHPRC. - Shells:
BASH_ENV,PROMPT_COMMAND,ZDOTDIR. - Git, SSH and the programs they open: every name starting with
GIT_CONFIG_, plusGIT_SSH,GIT_SSH_COMMAND,GIT_PROXY_COMMAND,GIT_EXTERNAL_DIFF,GIT_ASKPASS,SSH_ASKPASS,GIT_PAGER,GIT_EDITOR,PAGER,EDITORandVISUAL.
If your application needs one, for example NODE_OPTIONS to raise the Node.js memory limit, list it with the other keys the application uses:
dopbase run payment-service/production --only API_KEY,NODE_OPTIONS -- npm startDopbase then injects it and prints a warning that names it. Without --only, the warning lists the names it skipped instead.
A few other names change program behavior without loading code: NODE_VERSION, BROWSER, HOSTNAME, WINDIR, and USERPROFILE. Dopbase injects them and prints a warning.
If you did not expect one of these names in the environment, find out who stored it before you run the application again.
Order of precedence
For each stored secret, Dopbase checks in this order:
- With
--only, keys that were not named are left out. - Reserved names are skipped.
- Names that load code are skipped unless
--onlynamed them. - With
--preserve-env, a named key your shell already defines keeps the shell's value. - Anything left replaces the inherited variable of the same name.
Every warning and summary goes to standard error and contains names only, so the application's standard output stays clean.
Runtime behavior
Before starting the application, Dopbase writes the resolved project, environment, immutable ID, injected key count, and live or cache source to standard error. When filtering left keys out, the count reads 2 of 7 key(s). Cached runs also print the fetch timestamp and age. Values are never printed.
With a runner token the line leaves out the project, environment and ID, since that output usually lands in CI logs:
Dopbase: 12 key(s), source=liveDopbase then:
- Stops before launch if live retrieval fails and no usable matching cache is available, or when authentication, authorization, environment resolution, response validation, or cache authentication fails.
- Forwards operating-system signals to the child process.
- Returns the child's exit status to the calling shell.
- Avoids retaining plaintext values after the child starts where practical.
Applications still need to avoid printing their own environment variables. Dopbase cannot prevent a child process from logging a value after receiving it.