Skip to content

Instantly share code, notes, and snippets.

@avillela
Last active April 14, 2023 23:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save avillela/edf18f4d92f3a150eafcfc353c28cc7e to your computer and use it in GitHub Desktop.
Save avillela/edf18f4d92f3a150eafcfc353c28cc7e to your computer and use it in GitHub Desktop.
Dockerized ArgoCD CLI

How to Build & Run Dockerized ArogCD CLI

This quick guide shows you how to build a Dockerized argocd CLI. The advantage of this setup is that it's platform-independent. Also, I personally found the Linux installation annoying and buggy, and this proves to be a much more streamlined approach. Interestingly enough, the MacOS and the Windows installers were way less finnicky.

Dockerfile

Save the text below to Dockerfile.argocd in a folder called docker

FROM argoproj/argocd:v1.7.6 as builder

FROM ubuntu:18.04 as app

COPY --from=builder /usr/local/bin/argocd /usr/local/bin/argocd

ENTRYPOINT [ "argocd" ]

Build

Builds the file Dockerfile.argocd, located in the docker folder. Build context is docker

docker build -f docker/Dockerfile.argocd -t argocd-cli:1.0.0 docker

Run

Create an alias and add it to your .bashrc. This maps your local .kube/config and local ./argocd/config files to the ones in the container.

If you use Windows, alias creation will be a bit different for you. If you use a different 'nix shell, such as fish, for example, you'll save the alias to ~/.config/fish/config.fish instead.

alias argocd='docker run -it --rm -v ~/.kube/config:/root/.kube/config -v ~/.argocd/config:/root/.argocd/config argocd-cli:1.0.0' >> ~/.bashrc

Run your favorite argocd commands. For example:

argocd version
argocd repo add
argocd login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment