Skip to content

Feature Request | Remove Docker Dependency from Leverage CLI #313

Closed

Description

@exequielrafaela

Feature Request: Remove Docker Dependency from Leverage CLI

Describe the Feature

The Leverage CLI currently relies on Docker to encapsulate tool dependencies and execute commands. We propose removing this Docker dependency in favor of a native execution model (e.g., using Python +uv or system-installed tools) and environment variable–based credential handling.

Expected Behavior

  • The CLI should run directly on the user's machine without requiring Docker to be installed or running.
  • Authentication credentials (e.g., AWS temporary credentials) should be passed via environment variables or local config files, eliminating the need for containerized credentials or ENTRYPOINT logic.
  • Users can execute commands like leverage tf shell without installing or troubleshooting Docker.

Use Case

Current behavior causes friction when Docker isn’t installed, isn’t allowed due to company policy, or fails in macOS after Docker updates. Users experience environment mismatches, docker-in-docker complexity, cache issues, and slow startup times. A Dockerless CLI would:

  • Simplify onboarding and reduce cognitive overhead.
  • Cut down on maintenance effort and improve reliability.
  • Allow easier local debugging and integration with native tooling.

Describe Ideal Solution

  • Refactor the CLI to run all commands directly, eliminating Dockerfile, container build logic, and entrypoint.sh.
  • Use uv or system dependencies for OpenTofu / Terraform, AWS CLI, kubectl, etc.
  • Credentials should be passed via AWS_PROFILE, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, or leveraging existing AWS SDK configuration.
  • Remove all Docker-related features and files; repurpose CI to install required tools or reference official Dockerless workflows.
  • Provide a clear migration guide for users transitioning from Docker-based CLI to native CLI.

Additional Context

This change was discussed among the core team as a means to simplify CLI maintenance and tooling. Removing Docker would:

  • Reduce breakage related to Docker version mismatches or system upgrades.
  • Align with best practices for CLI tooling portability.
  • Enable smoother local development workflows and CI integration.

By adopting this approach, the Leverage CLI becomes leaner, easier to maintain, and more robust across a variety of developer environments.

Activity

  1. juanmatias commented on Dec 15, 2025

    @juanmatias
    Contributor

    @angelofenoglio @exequielrafaela

    layers flag

    It does not work.

    ❯ lta --layers network,cluster  
    [09:49:14.838] INFO     Invoking command for layer /home/jdelacamara/Work/OvenLabs/code/ovenlabs-leverage-infra/apps-dev/us-east-1/k8s-eks-faina/network...                                      
    ╷  
    │ Error: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: 11e997c6-47d6-4306-b8a  
    b-0d5b9ffce94a, api error ExpiredToken: The security token included in the request is expired  
    │    
    │    
    ╵
    

    kubectl

    discover

    It fails.

    apps-dev/us-east-1/k8s-eks-faina on  main [!?] via 🐍 v3.10.0 (ovenlabs-leverage-infra)    
    ❯ leverage kubectl discover    
    Traceback (most recent call last):  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/bin/leverage", line 8, in <module>  
       sys.exit(leverage())  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1137, in __call__  
       return self.main(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1062, in main  
       rv = self.invoke(ctx)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1668, in invoke  
       return _process_result(sub_ctx.command.invoke(sub_ctx))  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1646, in invoke  
       super().invoke(ctx)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1404, in invoke  
       return ctx.invoke(self.callback, **ctx.params)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 763, in invoke  
       return __callback(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func  
       return ctx.invoke(f, obj, *args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 763, in invoke  
       return __callback(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func  
       return f(get_current_context(), *args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 75, in kubectl  
       _handle_subcommand(  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/utils.py", line 44, in _handle_subcommand  
       context.invoke(subcommand)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 763, in invoke  
       return __callback(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/_internals.py", line 65, in new_command  
       return command(ctx.obj.paths, *args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 168, in discover  
       cluster_files = [(path, data) for path, data in _scan_clusters(paths)]  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 168, in <listcomp>  
       cluster_files = [(path, data) for path, data in _scan_clusters(paths)]  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 140, in _scan_clusters  
       for root, dirs, files in os.walk(paths.paths.cwd):  
    AttributeError: 'PathsHandler' object has no attribute 'paths'
    

    configure

    Under cluster directory runs ok

    us-east-1/k8s-eks-faina/cluster on  main [!?] via 🐍 v3.10.0 (ovenlabs-leverage-infra) via 💠 default    
    ❯ leverage kubectl configure  
    [15:58:04.996] INFO     Retrieving k8s cluster information...                                                                                                                                    
    [15:58:07.305] INFO     Attempting to get temporary credentials for shared account.                                                                                                              
    [15:58:07.308] INFO     Using already configured temporary credentials.                                                                                                                          
    [15:58:07.310] INFO     Attempting to get temporary credentials for apps-dev account.                                                                                                            
    [15:58:07.313] INFO     Using already configured temporary credentials.                                                                                                                          
    [15:58:12.744] INFO     Configuring context...                                                                                                                                                   
    [15:58:14.803] INFO     Attempting to get temporary credentials for shared account.                                                                                                              
    [15:58:14.806] INFO     Using already configured temporary credentials.                                                                                                                          
    [15:58:14.808] INFO     Attempting to get temporary credentials for apps-dev account.                                                                                                            
    [15:58:14.811] INFO     Using already configured temporary credentials.                                                                                                                          
    Updated context arn:aws:eks:us-east-1:036950457288:cluster/ol-apps-dev-eks-faina in /home/jdelacamara/.kube/config  
    [15:58:17.678] INFO     Done.
    

    Run it in a directory other than cluster

    us-east-1/k8s-eks-faina/k8s-components on  main [!?] via 🐍 v3.10.0 (ovenlabs-leverage-infra) via 💠 default    
    ❯ leverage kubectl configure  
    [15:57:33.771] INFO     Retrieving k8s cluster information...                                                                                                                                    
    [15:57:36.128] INFO     Attempting to get temporary credentials for shared account.                                                                                                              
    [15:57:36.131] INFO     Using already configured temporary credentials.                                                                                                                          
    [15:57:36.133] INFO     Attempting to get temporary credentials for apps-dev account.                                                                                                            
    [15:57:36.136] INFO     Using already configured temporary credentials.                                                                                                                          
    Traceback (most recent call last):  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/bin/leverage", line 8, in <module>  
       sys.exit(leverage())  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1137, in __call__  
       return self.main(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1062, in main  
       rv = self.invoke(ctx)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1668, in invoke  
       return _process_result(sub_ctx.command.invoke(sub_ctx))  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1646, in invoke  
       super().invoke(ctx)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 1404, in invoke  
       return ctx.invoke(self.callback, **ctx.params)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 763, in invoke  
       return __callback(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func  
       return ctx.invoke(f, obj, *args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 763, in invoke  
       return __callback(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func  
       return f(get_current_context(), *args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 75, in kubectl  
       _handle_subcommand(  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/utils.py", line 44, in _handle_subcommand  
       context.invoke(subcommand)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/click/core.py", line 763, in invoke  
       return __callback(*args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/_internals.py", line 65, in new_command  
       return command(ctx.obj.paths, *args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 133, in configure  
       _configure(layer_path=paths.cwd)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 90, in _configure  
       cmd = _get_eks_kube_config(layer_path).split(" ")[1:]  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/_internals.py", line 65, in new_command  
       return command(ctx.obj.paths, *args, **kwargs)  
     File "/home/jdelacamara/.local/share/virtualenvs/ovenlabs-leverage-infra-zBUxUb8z/lib/python3.10/site-packages/leverage/modules/kubectl.py", line 125, in _get_eks_kube_config  
       aws_eks_cmd = next(op for op in output.splitlines() if op.startswith("aws eks update-kubeconfig"))  
    StopIteration
    

    get pod

    Note when configuring kubectl:

    ❯ leverage kubectl configure set context arn:aws:eks:us-east-1:036950457288:cluster/ol-apps-dev-eks-faina  
    [16:04:16.289] INFO     Retrieving k8s cluster information...                                                                                                                                    
    [16:04:18.604] INFO     Attempting to get temporary credentials for apps-dev account.                                                                                                            
    [16:04:18.607] INFO     Using already configured temporary credentials.                                                                                                                          
    [16:04:18.610] INFO     Attempting to get temporary credentials for shared account.                                                                                                              
    [16:04:18.612] INFO     Using already configured temporary credentials.                                                                                                                          
    [16:04:24.020] INFO     Configuring context...                                                                                                                                                   
    [16:04:26.078] INFO     Attempting to get temporary credentials for apps-dev account.                                                                                                            
    [16:04:26.082] INFO     Using already configured temporary credentials.                                                                                                                          
    [16:04:26.085] INFO     Attempting to get temporary credentials for shared account.                                                                                                              
    [16:04:26.088] INFO     Using already configured temporary credentials.                                                                                                                          
    Updated context arn:aws:eks:us-east-1:036950457288:cluster/ol-apps-dev-eks-faina in /home/jdelacamara/.kube/config  
    [16:04:28.750] INFO     Done.                                                                                  
    

                                                                                    
    the config file is set in this directory: /home/jdelacamara/.kube/config

    Then, when using:

       
    ❯ leverage -v kubectl get nodes  
    [16:05:00.153] DEBUG    Found config file /home/jdelacamara/Work/OvenLabs/code/ovenlabs-leverage-infra/build.env                                                                                 
    [16:05:02.626] INFO     Attempting to get temporary credentials for shared account.                                                                                                              
    [16:05:02.630] DEBUG    Token expiration time: 1765396537.0                                                                                                                                      
    [16:05:02.632] DEBUG    Token renewal time: 1765395302.6300533                                                                                                                                   
    [16:05:02.634] INFO     Using already configured temporary credentials.                                                                                                                          
    [16:05:02.637] INFO     Attempting to get temporary credentials for apps-dev account.                                                                                                            
    [16:05:02.639] DEBUG    Token expiration time: 1765396536.0                                                                                                                                      
    [16:05:02.642] DEBUG    Token renewal time: 1765395302.6399014                                                                                                                                   
    [16:05:02.645] INFO     Using already configured temporary credentials.                                                                                                                          
    [16:05:02.647] DEBUG    Running command: /usr/local/bin/kubectl get nodes                                                                                                                        
    [16:05:02.650] DEBUG    Working directory: /home/jdelacamara/Work/OvenLabs/code/ovenlabs-leverage-infra/apps-dev/us-east-1/k8s-eks-faina/cluster                                                 
    [16:05:02.653] DEBUG    Additional environment variables: {'AWS_SHARED_CREDENTIALS_FILE': '/home/jdelacamara/.aws/ol/credentials', 'AWS_CONFIG_FILE': '/home/jdelacamara/.aws/ol/config',        
                           'KUBECONFIG': '/home/jdelacamara/.kube/ol/config'}                                                                                                                       
    E1210 16:05:02.740060  101521 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect:  
    connection refused"  
    E1210 16:05:02.742171  101521 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect:  
    connection refused"  
    E1210 16:05:02.744147  101521 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect:  
    connection refused"  
    E1210 16:05:02.746136  101521 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect:  
    connection refused"  
    E1210 16:05:02.748208  101521 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect:  
    connection refused"  
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    

    It is using a different directory 'KUBECONFIG': '/home/jdelacamara/.kube/ol/config'

    Finally, if I copy creds from one to another it works:

    ❯ cp /home/jdelacamara/.kube/config /home/jdelacamara/.kube/ol    
      
    ❯ leverage kubectl get nodes      
    [16:06:24.976] INFO     Attempting to get temporary credentials for apps-dev account.                                                                                                            
    [16:06:24.990] INFO     Using already configured temporary credentials.                                                                                                                          
    [16:06:24.993] INFO     Attempting to get temporary credentials for shared account.                                                                                                              
    [16:06:24.996] INFO     Using already configured temporary credentials.                                                                                                                          
    NAME                          STATUS   ROLES    AGE    VERSION  
    ip-10-1-10-242.ec2.internal   Ready    <none>   100m   v1.34.2-eks-ecaa3a6  
    ip-10-1-22-235.ec2.internal   Ready    <none>   37m    v1.34.2-eks-ecaa3a6
    
  2. angelofenoglio commented on Jan 6, 2026

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

Metadata

Metadata

Labels

enhancementmajor

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions