svg

Mencoba Lima-Vm

linux vm lima-vm

Hari ini aku membaca artikel Install Cloudflare Warp Client di Fedora Desktop dengan Lima-vm. Aku tertarik dengan lima-vm yang tertulis disana jadi memutuskan untuk mencobanya. Yang membuatku tertarik, lima-vm ini punya template docker. Jadi aku bisa spin VM yang didalamnya otomatis terintall docker engine dan expose docker socketnya, jadi bisa aku pakai di host.

 nix-shell -p lima docker_26
 limactl start template://docker
 limactl start docker
INFO[0000] Using the existing instance "docker"
INFO[0000] Starting the instance "docker" with VM driver "qemu"
INFO[0000] [hostagent] hostagent socket created at /home/sumar/.lima/docker/ha.sock
INFO[0001] [hostagent] Using system firmware ("/nix/store/naikwpmdnmlwa813n0jbdhvdm8i25frs-qemu-9.2.0/share/qemu/edk2-x86_64-code.fd")
INFO[0001] [hostagent] Starting QEMU (hint: to watch the boot progress, see "/home/sumar/.lima/docker/serial*.log")
INFO[0001] SSH Local Port: 43173
INFO[0001] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0011] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0026] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0029] [hostagent] The essential requirement 1 of 2 is satisfied
INFO[0029] [hostagent] Waiting for the essential requirement 2 of 2: "user session is ready for ssh"
INFO[0029] [hostagent] The essential requirement 2 of 2 is satisfied
INFO[0029] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0029] [hostagent] Forwarding "/run/user/1000/docker.sock" (guest) to "/home/sumar/.lima/docker/sock/docker.sock" (host)
INFO[0029] [hostagent] Forwarding "/run/lima-guestagent.sock" (guest) to "/home/sumar/.lima/docker/ga.sock" (host)
INFO[0029] [hostagent] Guest agent is running
INFO[0029] [hostagent] Not forwarding TCP [::]:22
INFO[0029] [hostagent] Not forwarding TCP 127.0.0.54:53
INFO[0029] [hostagent] Not forwarding TCP 127.0.0.53:53
INFO[0029] [hostagent] The optional requirement 1 of 1 is satisfied
INFO[0029] [hostagent] Waiting for the guest agent to be running
INFO[0029] [hostagent] Waiting for the final requirement 1 of 1: "boot scripts must have finished"
INFO[0030] [hostagent] The final requirement 1 of 1 is satisfied
INFO[0030] READY. Run `limactl shell docker` to open the shell.
INFO[0030] Message from the instance "docker":
To run `docker` on the host (assumes docker-cli is installed), run the following commands:
------
docker context create lima-docker --docker "host=unix:///home/sumar/.lima/docker/sock/docker.sock"
docker context use lima-docker
docker run hello-world
------
 docker context use lima-docker
lima-docker
Current context is now "lima-docker"

 docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Praktis banget, nice.