title | description | keywords | facebookImage | twitterImage | hidden | section | tableOfContents | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Containers on Linux |
How to setup and use LXC/LXD
|
|
/_social/article |
/_social/article |
false |
software |
true |
Sometimes an older version of a library or libraries for an application is needed for development. It is faster and easier to use LXC/LXD to setup a Container of that release and work in that Container.
First open a terminal like so:
Pop!_OS : + T
Ubuntu : CTRL+ALT+T
Install the software with this command in the terminal.
sudo apt install lxd lxd-client
Tell LXD what storage and network is needed with this command:
sudo lxd init
Now create our first container with this command:
lxc launch ubuntu:16.04 first
This will create a container based on Ubuntu 16.04 with the name 'first'.
List and confirm that the container was created with this command:
lxc list
The container can be stopped with this command:
lxc stop first
Or the container can be deleted:
lxc delete first
Enter the container with this command:
lxc exec first -- /bin/bash
Or just one command can be issued without entering the container:
lxc exec first -- apt update
For pushing a file to the container:
lxc file push filename first/tmp/
For pulling a file from the container:
lxc file pull first/tmp/filename .