Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-env errors if ~/.ssh doesn't exist #16933

Closed
sethrylan opened this issue Jul 21, 2023 · 5 comments · Fixed by #16934
Closed

docker-env errors if ~/.ssh doesn't exist #16933

sethrylan opened this issue Jul 21, 2023 · 5 comments · Fixed by #16934
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@sethrylan
Copy link
Contributor

What Happened?

Starting with v1.31.0, docker-env will fail if the ~/.ssh directory doesn't exist. This is the case on most linux hosts that have not generated ssh keys (e.g., short-lived VMs).

Introduced in #15452.

The workaround is to run mkdir -p ~/.ssh.

➜  minikube start     
😄  minikube v1.31.1 on Ubuntu 20.04 (docker/amd64)
✨  Automatically selected the docker driver. Other choices: none, ssh
📌  Using Docker driver with root privileges
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
💾  Downloading Kubernetes v1.27.3 preload ...
    > preloaded-images-k8s-v18-v1...:  393.19 MiB / 393.19 MiB  100.00% 79.18 M
    > gcr.io/k8s-minikube/kicbase...:  446.99 MiB / 447.62 MiB  99.86% 53.11 Mi
🔥  Creating docker container (CPUs=2, Memory=2200MB) ...
🐳  Preparing Kubernetes v1.27.3 on Docker 24.0.4 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🔎  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

➜ ls ~/.ssh                                                                            
ls: cannot access '/home/codespace/.ssh': No such file or directory

➜  minikube docker-env --alsologtostderr
I0721 22:17:37.953472    8919 out.go:296] Setting OutFile to fd 1 ...
I0721 22:17:37.955057    8919 out.go:348] isatty.IsTerminal(1) = true
I0721 22:17:37.955074    8919 out.go:309] Setting ErrFile to fd 2...
I0721 22:17:37.955084    8919 out.go:348] isatty.IsTerminal(2) = true
I0721 22:17:37.956115    8919 root.go:338] Updating PATH: /home/codespace/.minikube/bin
W0721 22:17:37.956482    8919 root.go:314] Error reading config file at /home/codespace/.minikube/config/config.json: open /home/codespace/.minikube/config/config.json: no such file or directory
I0721 22:17:37.956897    8919 mustload.go:65] Loading cluster: minikube
I0721 22:17:37.957747    8919 config.go:182] Loaded profile config "minikube": Driver=docker, ContainerRuntime=docker, KubernetesVersion=v1.27.3
I0721 22:17:37.958997    8919 cli_runner.go:164] Run: docker container inspect minikube --format={{.State.Status}}
I0721 22:17:37.984737    8919 host.go:66] Checking if "minikube" exists ...
I0721 22:17:37.985298    8919 cli_runner.go:164] Run: docker system info --format "{{json .}}"
I0721 22:17:40.770985    8919 cli_runner.go:217] Completed: docker system info --format "{{json .}}": (2.7852698s)
I0721 22:17:40.771371    8919 info.go:266] docker info: {ID:HLI4:QJGT:EWTO:KKN4:4JO2:M5PQ:46WV:RDOI:SUOX:WQDP:3VLE:POXK Containers:1 ContainersRunning:1 ContainersPaused:0 ContainersStopped:0 Images:1 Driver:overlay2 DriverStatus:[[Backing Filesystem extfs] [Supports d_type true] [Native Overlay Diff false] [userxattr false]] SystemStatus:<nil> Plugins:{Volume:[local] Network:[bridge host ipvlan macvlan null overlay] Authorization:<nil> Log:[awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog]} MemoryLimit:true SwapLimit:true KernelMemory:false KernelMemoryTCP:false CPUCfsPeriod:true CPUCfsQuota:true CPUShares:true CPUSet:true PidsLimit:true IPv4Forwarding:true BridgeNfIptables:true BridgeNfIP6Tables:true Debug:false NFd:32 OomKillDisable:false NGoroutines:45 SystemTime:2023-07-21 22:17:38.0361826 +0000 UTC LoggingDriver:json-file CgroupDriver:cgroupfs NEventsListener:0 KernelVersion:5.15.0-1041-azure OperatingSystem:Ubuntu 20.04.6 LTS (containerized) OSType:linux Architecture:x86_64 IndexServerAddress:https://index.docker.io/v1/ RegistryConfig:{AllowNondistributableArtifactsCIDRs:[] AllowNondistributableArtifactsHostnames:[] InsecureRegistryCIDRs:[127.0.0.0/8] IndexConfigs:{DockerIo:{Name:docker.io Mirrors:[] Secure:true Official:true}} Mirrors:[]} NCPU:2 MemTotal:4104077312 GenericResources:<nil> DockerRootDir:/var/lib/docker HTTPProxy: HTTPSProxy: NoProxy: Name:codespaces-e39d60 Labels:[] ExperimentalBuild:false ServerVersion:20.10.25+azure-2 ClusterStore: ClusterAdvertise: Runtimes:{Runc:{Path:runc}} DefaultRuntime:runc Swarm:{NodeID: NodeAddr: LocalNodeState:inactive ControlAvailable:false Error: RemoteManagers:<nil>} LiveRestoreEnabled:false Isolation: InitBinary:docker-init ContainerdCommit:{ID:3dce8eb055cbb6872793272b4f20ed16117344f8 Expected:3dce8eb055cbb6872793272b4f20ed16117344f8} RuncCommit:{ID:860f061b76bb4fc671f0f9e900f7d80ff93d4eb7 Expected:860f061b76bb4fc671f0f9e900f7d80ff93d4eb7} InitCommit:{ID: Expected:} SecurityOptions:[name=apparmor name=seccomp,profile=default name=cgroupns] ProductLicense: Warnings:<nil> ServerErrors:[] ClientInfo:{Debug:false Plugins:[map[Name:buildx Path:/usr/libexec/docker/cli-plugins/docker-buildx SchemaVersion:0.1.0 ShortDescription:Docker Buildx Vendor:Docker Inc. Version:0.11.0+azure-1] map[Name:compose Path:/usr/libexec/docker/cli-plugins/docker-compose SchemaVersion:0.1.0 ShortDescription:Docker Compose Vendor:Docker Inc. Version:2.18.1+azure-2]] Warnings:<nil>}}
I0721 22:17:40.771678    8919 ssh_runner.go:195] Run: systemctl --version
I0721 22:17:40.771818    8919 cli_runner.go:164] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube
I0721 22:17:40.810790    8919 sshutil.go:53] new ssh client: &{IP:127.0.0.1 Port:32772 SSHKeyPath:/home/codespace/.minikube/machines/minikube/id_rsa Username:docker}
I0721 22:17:40.905730    8919 ssh_runner.go:195] Run: sudo systemctl is-active --quiet service docker
I0721 22:17:40.922615    8919 cli_runner.go:164] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube
I0721 22:17:40.959179    8919 docker-env.go:666] Testing Docker connectivity with: /usr/bin/docker version --format={{.Server}}
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.49.2:2376"
export DOCKER_CERT_PATH="/home/codespace/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="minikube"

# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)
I0721 22:17:41.125859    8919 mustload.go:65] Loading cluster: minikube
I0721 22:17:41.126117    8919 config.go:182] Loaded profile config "minikube": Driver=docker, ContainerRuntime=docker, KubernetesVersion=v1.27.3
I0721 22:17:41.126942    8919 cli_runner.go:164] Run: docker container inspect minikube --format={{.State.Status}}
I0721 22:17:41.153263    8919 host.go:66] Checking if "minikube" exists ...
I0721 22:17:41.153558    8919 host.go:66] Checking if "minikube" exists ...
I0721 22:17:41.154187    8919 cli_runner.go:164] Run: docker container inspect minikube --format={{.State.Status}}
I0721 22:17:41.196311    8919 cli_runner.go:164] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube
I0721 22:17:41.400759    8919 host.go:66] Checking if "minikube" exists ...
I0721 22:17:41.403715    8919 cli_runner.go:164] Run: docker container inspect minikube --format={{.State.Status}}
I0721 22:17:41.431829    8919 cli_runner.go:164] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube
Host added: /home/codespace/.ssh/known_hosts ([127.0.0.1]:32772)
W0721 22:17:41.457726    8919 out.go:239] OpenFile: open /home/codespace/.ssh/known_hosts: no such file or directory
OpenFile: open /home/codespace/.ssh/known_hosts: no such file or directory

Attach the log file

log.txt

Operating System

Ubuntu

Driver

Docker

@sethrylan
Copy link
Contributor Author

Fix proposed in #16934

@medyagh
Copy link
Member

medyagh commented Aug 9, 2023

@sethrylan thank you for creating this issue, that is a regression and we must fix that, however it doesnt seem to be affecting the functionality of docker-env but scares the user with an ugly error message.

@medyagh
Copy link
Member

medyagh commented Aug 9, 2023

cc: @ComradeProgrammer

@medyagh medyagh changed the title docker-env fails if ~/.ssh doesn't exist docker-env errors if ~/.ssh doesn't exist Aug 9, 2023
@medyagh medyagh added kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Aug 9, 2023
@TenzinChang
Copy link

i confirm the same error happened to me (just today) - the workaround mkdir -p .ssh worked but this is a regression since it's causing 'Run on Cloud Run Emulator' to fail.

cloud-code/installer/google-cloud-sdk/bin/minikube docker-env --shell none -p cloud-run-dev-internal --user=skaffold
DOCKER_TLS_VERIFY=1
DOCKER_HOST=tcp://127.0.0.1:57064
DOCKER_CERT_PATH=/Users/lichungchang/.minikube/certs
MINIKUBE_ACTIVE_DOCKERD=cloud-run-dev-internal
SSH_AUTH_SOCK=
SSH_AGENT_PID=
Host added: /Users/lichungchang/.ssh/known_hosts ([127.0.0.1]:57063)
OpenFile: open /Users/lichungchang/.ssh/known_hosts: no such file or directory

@medyagh
Copy link
Member

medyagh commented Aug 14, 2023

i confirm the same error happened to me (just today) - the workaround mkdir -p .ssh worked but this is a regression since it's causing 'Run on Cloud Run Emulator' to fail.

cloud-code/installer/google-cloud-sdk/bin/minikube docker-env --shell none -p cloud-run-dev-internal --user=skaffold DOCKER_TLS_VERIFY=1 DOCKER_HOST=tcp://127.0.0.1:57064 DOCKER_CERT_PATH=/Users/lichungchang/.minikube/certs MINIKUBE_ACTIVE_DOCKERD=cloud-run-dev-internal SSH_AUTH_SOCK= SSH_AGENT_PID= Host added: /Users/lichungchang/.ssh/known_hosts ([127.0.0.1]:57063) OpenFile: open /Users/lichungchang/.ssh/known_hosts: no such file or directory

Hi @TenzinChang do you mind pinging me internally ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants