Skip to content

Instantly share code, notes, and snippets.

@zeqk
Forked from avillela/dockerized_argocd_cli.md
Created February 1, 2023 16:24
Show Gist options
  • Save zeqk/acc888b963c524189aad7954c89dd95c to your computer and use it in GitHub Desktop.
Save zeqk/acc888b963c524189aad7954c89dd95c 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
@zeqk
Copy link
Author

zeqk commented Feb 1, 2023

sudo docker run -it --rm -v ~/.kube/config:/home/argocd/.kube/config quay.io/argoproj/argocd:v2.5.8 


sudo docker run -it --rm -v ~/.argocd/config:/home/argocd/.argocd/config quay.io/argoproj/argocd:v2.5.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment