EKS Anywhere with Docker provider is now working inside the devcontainer!
The critical fix was using a directory inside the project that is bind-mounted from the host:
CLUSTERS_DIR="/workspaces/shift-eks/.eks-clusters"This allows both the devcontainer and host Docker daemon to access the same files.
- eksctl - Main CLI from eksctl-io/eksctl
- eksctl-anywhere - Plugin for EKS Anywhere
Both are installed in the Dockerfile:
# Install eksctl (required for eksctl-anywhere plugin)
RUN curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz" \
| tar xz -C /tmp \
&& mv /tmp/eksctl /usr/local/bin/eksctl \
&& chmod +x /usr/local/bin/eksctl
# Install eksctl-anywhere plugin
ARG EKSA_VERSION=0.23.3
RUN curl -Lo /tmp/eksctl-anywhere.tar.gz \
"https://github.com/aws/eks-anywhere/releases/download/v${EKSA_VERSION}/eksctl-anywhere-v${EKSA_VERSION}-linux-amd64.tar.gz" \
&& tar -xzf /tmp/eksctl-anywhere.tar.gz -C /tmp \
&& mv /tmp/eksctl-anywhere /usr/local/bin/eksctl-anywhere \
&& chmod +x /usr/local/bin/eksctl-anywhere \
&& rm -f /tmp/eksctl-anywhere.tar.gzeksctl anywhere versioncd /workspaces/shift-eks/.eks-clusters
eksctl anywhere generate clusterconfig eks-local --provider docker > eks-local-config.yaml
eksctl anywhere create cluster -f eks-local-config.yamlexport KUBECONFIG=/workspaces/shift-eks/.eks-clusters/eks-local/eks-local-eks-a-cluster.kubeconfig
kubectl get nodes
kubectl get pods -Aeksctl anywhere get clusters
docker ps | grep eks-localWhen running, you'll see these Docker containers:
eks-local-mm9d4- Control plane nodeeks-local-md-0-*- Worker node(s)eks-local-etcd-*- External etcdeks-local-lb- Load balancer (HAProxy)eks-local-eks-a-cluster-control-plane- Bootstrap cluster (kind)
The cluster is automatically started via:
.devcontainer/start-eks-anywhere.sh- Creates/starts EKS Anywhere cluster.devcontainer/start-openshift-crc.sh- Creates/starts OpenShift CRC cluster.devcontainer/start-clusters.sh- Orchestrates both CRC and EKS-A startuppostStartCommandin devcontainer.json
Use the cluster-manager.sh script:
./cluster-manager.sh status # Check both clusters
./cluster-manager.sh switch-eks # Switch to EKS Anywhere
./cluster-manager.sh restart-eks # Restart EKS Anywhere cluster- Project directory
/workspaces/shift-eksis bind-mounted from host - EKS Anywhere creates files in
/workspaces/shift-eks/.eks-clusters - When EKS Anywhere launches Docker containers, it mounts this path
- Host Docker daemon can access the bind-mounted directory
- Relative paths resolve correctly inside nested containers
Host: /workspaces/shift-eks/.eks-clusters
↓ (bind mount)
DevContainer: /workspaces/shift-eks/.eks-clusters
↓ (volume mount by EKS Anywhere)
EKS-A Container: /workspaces/shift-eks/.eks-clusters
↓ (relative paths)
Kind: eks-local/generated/kind_tmp.yaml ✅
- Using
/home/vscode/clusters- Not accessible to host Docker - Using Docker volumes - Path mismatch between devcontainer and host
- Using
/tmpor other non-mounted paths
docker ps | grep eks-localls -la /workspaces/shift-eks/.eks-clusters/eksa-cli-logs/
cat /workspaces/shift-eks/.eks-clusters/eksa-cli-logs/*.log | tail -50ls -la /workspaces/shift-eks/.eks-clusters/eks-local/*.kubeconfigdocker inspect $(docker ps | grep eksa_ | awk '{print $1}') | jq '.[0].Mounts'