Skip to content

Execute a command inside an lxd container while capturing its output and forwarding the Ctrl+C signal

Notifications You must be signed in to change notification settings

rgl/lxd-exec-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Example lxd client library to execute a command inside an lxd container while capturing its output and forwarding the Ctrl+C signal.

Usage

export LXD_SOCKET='/var/snap/lxd/common/lxd/unix.socket'

# init lxd (if required).
# see https://linuxcontainers.org/lxd/docs/latest/howto/initialize/
lxd init

# launch the example container.
lxc delete --force lxd-exec-example
lxc launch images:debian/11 lxd-exec-example

# build this example binary, upload it to the container, and execute it.
CGO_ENABLED=0 go build
lxc file push lxd-exec-example lxd-exec-example/lxd-exec-example
./lxd-exec-example

About

Execute a command inside an lxd container while capturing its output and forwarding the Ctrl+C signal

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages