รวมคำสั่งที่ใช้งานบ่อยๆ
คำสั่งที่ใช้ในการติดตั้ง
1 2 3 | sudo snap install lxd sudo lxd init sudo usermod --append -- groups lxd sarankon |
การจัดการเกี่ยวกับ Container
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # Create new container lxc launch images:< alias -name> <container-name> lxc launch images:alpine /3 .10 alpine # List the list of container lxc list # Show the info of container, *snapshot show here! lxc info <container-name> # Start and Stop container lxc start <container-name> lxc stop <container-name> # Delete container lxc delete <container-name> lxc delete <container-name> --force # Run command in container lxc exec <container-name> -- < command > # Run apt update command lxc exec <container-name> -- apt update # Use bash in container lxc exec <container-name> -- bash # Use default editor to edit file in container lxc file edit <container-name>/<path /file .txt> # Push file to container lxc file push < file > <container-name>/<path> # Create snapshot lxc snapshot <container-name> <snapshot-name> # Restore snapshot lxc restore <container-name> <snapshot-name> # Delete snapshot lxc delete <container-name>/<snapshot-name> # Create container from snapshot lxc copy <container-name>/<snapshot-name> <new-container-name> # lxc start <container-name> // after create from snapshot |