Docker¶
The published Docker image includes cgt-calc and Python. Use it if you already have Docker and do not want to install these tools on your computer. Images are available for amd64 and arm64 (Apple silicon).
Open a terminal in the directory containing your transaction files, then start the container:
cd ~/Taxes/Transactions
docker run --rm -it -v "$PWD":/data ghcr.io/cgt-calc/capital-gains-calculator
On native Linux, add --user "$(id -u):$(id -g)" immediately after docker run in this command and
the ones below so generated files are owned by you.
The container opens a shell in /data, which is the directory you started from. Run cgt-calc there
using the normal report instructions. For example:
cgt-calc --year 2024 schwab_transactions.csv
The generated out/ directory remains on your computer after the container stops. Run exit when
you are finished.
You can also run a single command directly:
docker run --rm -v "$PWD":/data ghcr.io/cgt-calc/capital-gains-calculator -lc \
"cgt-calc --year 2024 schwab_transactions.csv"
Available tags¶
latest: the latest releaseX.Y.Z: a specific release, use one to keep the same software versionedge: the latest development build from themainbranch
Keeping the same software version does not guarantee an identical report: fetched market data can
change. Keep your input files, command and software version with the report, together with the CSV
files cgt-calc saved in out/ (exchange_rates.csv, isin_translation.csv and spin_offs.csv,
where present) and any extra data files you passed. See
saving exchange rates for what the rates cache
preserves.
Updating the image¶
The commands above use latest. Docker normally reuses an image already on your computer, even if a
newer release is available. To download the latest release, run:
docker pull ghcr.io/cgt-calc/capital-gains-calculator:latest
Then run the container as above. See Docker's pull policy for other update options.
Other container runtimes¶
With Colima's default Docker runtime, run
colima start, then use the docker commands above. You also need the Docker command-line client
installed.
The images use the standard Linux OCI format. If you use Podman or Apple's
container, follow that runtime's instructions for running an
image and mounting your transaction directory at /data.
Building locally¶
To build the image locally instead, run this with the cloned repository as the current working directory:
docker buildx build --tag capital-gains-calculator .
docker run --rm -it -v "$PWD":/data capital-gains-calculator
The build reads cgt-calc's version from the repository's Git history, which Docker receives with the rest of the directory. If you build from a linked Git worktree, whose history is stored outside its directory, the build stops and asks for the version. Pass it like this:
docker buildx build --build-arg VERSION="$(git describe --tags --match 'v[0-9]*')" \
--tag capital-gains-calculator .