Skip to content

Instantly share code, notes, and snippets.

@greatsharma
Created June 22, 2020 05:10
Show Gist options
  • Save greatsharma/d427b569b8729de0d8ac69a8ef874717 to your computer and use it in GitHub Desktop.
Save greatsharma/d427b569b8729de0d8ac69a8ef874717 to your computer and use it in GitHub Desktop.
Some important lxc lxd commands
* sudo gpasswd -a user_name[like winter_soilder] lxd [to add user to the lxd group so no sudo is required to execute lxc cmds]
* getent group group_name[lxd] [to see the group members]
* lxd init [initialize lxd env]
* lxc version
* lxc help | less
* sudo systemctl status lxd
* sudo systemctl enable lxd
* sudo systemctl start lxd
* lxc help command [get help for a specific command]
* lxc list [list all lxc containers in the system]
* lxc image list [list all images in the host machine]
* lxc image list images [list all publically available images]
* lxc remote list [all remote sources for pulling image]
* lxc launch image_path image_name[optional] [start an lxc container]
* lxc start container_name
* lxc stop container_name
* lxc delete container_name
* lxc copy old_container new_container
* lxc exec container_name bash [login to container]
* lxc info container_name
* lxc config show container_name
* lxc profile copy old_profile new_profile [copy profiles]
* lxc profile list
* lxc profile edit profile_name
* lxc profile add container_name profile_name
* lxc launch image_name container_name --profile profile_name [launch a container with a given profile]
* lxc config set container_name limits.memory 512MB [set dynamically]
* lxc config set container_name security.privileged true
* lxc config set container_name security.nesting true
* lxc file push path_from_host path_to_lxc
* lxc file pull path_from_lxc path_in_host [--recursive for entire directory]
* lxc snapshot container_name snap_name
* lxc restore container_name snap_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment