@@ -233,6 +233,24 @@ func mustRestartDockerd(name string, runner command.Runner) {
233
233
}
234
234
}
235
235
236
+ // ensurePodman ensures podman inside minikube is running before a docker-env command
237
+ func ensurePodman (name string , r command.Runner ) {
238
+ if ok := isPodmanActive (r ); ok {
239
+ return
240
+ }
241
+ startPodman (r )
242
+ }
243
+
244
+ // isPodmanActive checks if Podman is active
245
+ func isPodmanActive (r command.Runner ) bool {
246
+ return sysinit .New (r ).Active ("podman.socket" )
247
+ }
248
+
249
+ // startPodman will attempt to start podman
250
+ func startPodman (r command.Runner ) {
251
+ sysinit .New (r ).Start ("podman.socket" )
252
+ }
253
+
236
254
func waitForAPIServerProcess (cr command.Runner , start time.Time , timeout time.Duration ) error {
237
255
klog .Infof ("waiting for apiserver process to appear ..." )
238
256
err := apiWait .PollUntilContextTimeout (context .Background (), time .Millisecond * 500 , timeout , true , func (_ context.Context ) (bool , error ) {
@@ -312,14 +330,26 @@ docker-cli install instructions: https://minikube.sigs.k8s.io/docs/tutorials/doc
312
330
exit .Message (reason .Usage , err .Error ())
313
331
}
314
332
333
+ forceSSH := false
334
+
315
335
// for the sake of docker-env command, start nerdctl and nerdctld
316
336
if cr == constants .Containerd {
317
337
out .WarningT ("Using the docker-env command with the containerd runtime is a highly experimental feature, please provide feedback or contribute to make it better" )
318
338
319
339
startNerdctld ()
340
+ forceSSH = true
341
+ }
342
+ if cr == constants .CRIO {
343
+ if _ , err := co .CP .Runner .RunCmd (exec .Command ("sudo" , "ln" , "-sf" , "/run/podman/podman.sock" , "/var/run/docker.sock" )); err != nil {
344
+ exit .Message (reason .SSHAgentStart , err .Error ())
345
+ }
346
+ forceSSH = true
347
+ }
320
348
349
+ if forceSSH {
321
350
// docker-env on containerd depends on nerdctld (https://github.com/afbjorklund/nerdctld) as "docker" daeomn
322
351
// and nerdctld daemon must be used with ssh connection (it is set in kicbase image's Dockerfile)
352
+ // the podman service must be used with ssh connection (it does not support tcp connection)
323
353
// so directly set --ssh-host --ssh-add to true, even user didn't specify them
324
354
sshAdd = true
325
355
sshHost = true
@@ -342,6 +372,9 @@ docker-cli install instructions: https://minikube.sigs.k8s.io/docs/tutorials/doc
342
372
if cr == constants .Docker {
343
373
ensureDockerd (cname , r )
344
374
}
375
+ if cr == constants .CRIO {
376
+ ensurePodman (cname , r )
377
+ }
345
378
346
379
d := co .CP .Host .Driver
347
380
port := constants .DockerDaemonPort
@@ -672,9 +705,6 @@ func tryDockerConnectivity(bin string, ec DockerEnvConfig) ([]byte, error) {
672
705
}
673
706
674
707
func dockerEnvSupported (containerRuntime , driverName string ) error {
675
- if containerRuntime != constants .Docker && containerRuntime != constants .Containerd {
676
- return fmt .Errorf ("the docker-env command only supports the docker and containerd runtimes" )
677
- }
678
708
// we only support containerd-env on the Docker driver
679
709
if containerRuntime == constants .Containerd && driverName != driver .Docker {
680
710
return fmt .Errorf ("the docker-env command only supports the containerd runtime with the docker driver" )
0 commit comments