Provisioning Docker with a GUI
Need a GUI for docker on LInux?
Multipass provides a virtual machine running Docker Engine and a containerised Portainer application. This virtual machine can be deployed with just a single command, i.e. multipass launch docker
. Everything is pre-configured, automatically downloaded, and launched in one go.
This makes it extremely simple and easy to get a full Docker environment and a Portainer environment up and running. Portainer gives you a graphical user interface (GUI) for managing Docker containers on Linux, which makes things way easier when compared to using the Docker CLI. This setup is ideal for beginners.
Installing the Docker Virtual Machine
Open up a terminal and type multipass launch docker
. This command will automatically create a virtual machine running the latest version of Ubuntu, with Docker and Portainer installed and configured for you.
List installed virtual machines
After the Docker VM installation completes, you can confirm its local availability by using multipass list
. This command will list all locally installed Multipass virtual machines.
sysadmin@demo:~$ multipass list
Name State IPv4 Image
primary Running 10.5.129.80 Ubuntu 20.04 LTS
adguard-home Running 10.5.129.39 Ubuntu AdGuard Home Appliance
docker Running 10.5.129.147 Ubuntu 21.10 ---> docker is installed
172.17.0.1
foo Running 10.5.129.196 Ubuntu 20.04 LTS
Show the Docker Virtual Machine's specs
After installing the Docker VM you can check the VM's specs using the command multipass info docker
.
sysadmin@demo:~$ multipass info docker
Name: docker
State: Running
IPv4: 10.5.129.147
Release: Ubuntu 21.10
Image hash: 2428ea070f5c (Ubuntu 21.10)
Load: 0.38 0.20 0.08
Disk usage: 1.6G out of 38.6G
Memory usage: 203.5M out of 3.8G
Mounts: --
Exploring the Docker Virtual Machine
Log in to the Docker Virtual Machine's shell
To login to the virtual machine's shell, execute the command: multipass shell docker
. Upon login, a banner is displayed with the virtual machine's specifications. The number of available updates, if any, is also displayed.
sysadmin@demo:~$ multipass shell docker
Welcome to Ubuntu 21.10 (GNU/Linux 5.13.0-48-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Wed Jun 15 13:35:58 SAST 2022
System load: 0.36 Processes: 118
Usage of /: 4.1% of 38.60GB Users logged in: 0
Memory usage: 6% IPv4 address for ens3: 10.5.129.147
Swap usage: 0%
0 updates can be applied immediately.
New release '22.04 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
A standard Ubuntu Linux shell
Once inside the VM's shell, you can execute Linux commands as usual. So let's run some standard Linux commands.
ubuntu@docker:~$ uname -a
Linux docker 5.13.0-48-generic #54-Ubuntu SMP Wed Jun 1 20:38:48 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@docker:~$ hostname
docker
ubuntu@docker:~$ hostnamectl
Static hostname: docker
Icon name: computer-vm
Chassis: vm
Machine ID: 1fd7d3e33f964b5d8c911c8c8ca4d2f9
Boot ID: fa582f481887422abd991911176e8162
Virtualization: kvm
Operating System: Ubuntu 21.10
Kernel: Linux 5.13.0-48-generic
Architecture: x86-64
Hardware Vendor: QEMU
Hardware Model: Standard PC _i440FX + PIIX, 1996_
Installed Snaps
Checking what Snaps are installed as standard in the Docker Virtual Machine:
Name Version Rev Tracking Publisher Notes
core18 20220428 2409 latest/stable canonical✓ base
core20 20220527 1518 latest/stable canonical✓ base
lxd 5.2-79c3c3b 23155 latest/stable/… canonical✓ -
snapd 2.56 16010 latest/stable canonical✓ snapd
yq 4.24.2 1702 latest/stable mikefarah -
Installed container(s)
Listing all installed containers shows a single container named portainer. Notice that the container occupies only 275MB on disk.
ubuntu@docker:~$ docker container ls -s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
a20b5d043559 portainer/portainer-ce "/portainer" 5 days ago Up 5 days 8000/tcp, 9443/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp portainer 0B (virtual 275MB)
Portainer as a GUI
The Docker workflow comes with Portainer installed as a container, as shown in the previous section (above). Portainer gives us a graphical user interface for managing any Docker containers we install.
"Portainer is a multi-cluster, multi-cloud container management platform that supports Docker, Swarm, Nomad, and Kubernetes running in any Data Center, Cloud, Network Edge, or IIoT Device". - source: www.portainer.io
To access Portainer, we will need its IP address. The multipass list
command will show the IP addresses that are associated with the Docker VM:
sysadmin@demo:~$ multipass list
Name State IPv4 Image
adguard-home Running 10.5.129.39 Ubuntu AdGuard Home Appliance
docker Running 10.5.129.147 Ubuntu 21.10 ---> 1st address
172.17.0.1 ---> 2nd address
foo Running 10.5.129.196 Ubuntu 20.04 LTS
There are two IP addresses listed for the Docker VM. One IP is for the Docker instance, and the other IP is for the Portainer container. The Portainer IP should start with a 10. In this demo, the relevant IP is 10.5.129.147.
Connecting to Portainer
In a web browser, enter the Portainer IP address followed by the Portainer port, 9000. Set up a username and password at the prompt, select the option for managing a local Docker environment, and click connect.
After a successful login, the Portainer Home screen is loaded.
App templates
On the left-hand side panel, select App Templates
. A list of available container templates is loaded. You can then select a required template from the list and configure and deploy it as a container to your local machine.
Done
That's it from me.
References:
2) Single-command Docker environments on any machine with Multipass
3) Running a container with the Docker workflow in Multipass