Search code examples
jsonvisual-studio-codevscode-extensionsgoogle-cloud-code

Failed to start minikube: Error while starting minikube. Error: X Exiting due to MK_USAGE: Container runtime must be set to "containerd" for rootless


I'm getting the error and I believe the way to solve it is by running: minikube start --container-runtime=containerd but the extension seems to run minikube start. So how am I supposed to add the flag? Here's the launch.json file

{
    "configurations": [
        {
            "name": "Cloud Run: Run/Debug Locally",
            "type": "cloudcode.cloudrun",
            "request": "launch",
            "build": {
                "docker": {
                    "path": "Dockerfile"
                }
            },
            "image": "dai",
            "service": {
                "name": "dai",
                "containerPort": 8080,
                "resources": {
                    "limits": {
                        "memory": "256Mi"
                    }
                }
            },
            "target": {
                "minikube": {}
            },
            "watch": true
        }
    ]
}

Solution

  • Cloud Code for VS Code doesn't support such settings at the moment. But you can configure minikube to apply these settings with minikube config set.

    The Cloud Run emulation creates a separate minikube profile called cloud-run-dev-internal. So you should be able to run the following:

    minikube config set --profile cloud-run-dev-internal container-runtime containerd
    

    You have to delete that minikube profile to cause the setting to take effect for your next launch:

    minikube delete --profile cloud-run-dev-internal