Docker is a software platform designed to make it easier to create, deploy, and run applications by using containers. It offers OS-level virtualization to deliver software in packages called containers.
Docker compose is a tool for running multi-container applications on Docker.
Portainer is a lightweight management UI witch allows you to easily create, manage, and delete your Docker containers
Installation:
# 1. Pull the latest version:
sudo docker pull portainer/portainer-ce:latest
# 2. Run this container.
sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
We define the ports we want Portainer to have access to, a name (“portainer”), and we also tell the Docker manager that we want to restart this Docker if it is ever unintentionally offline.
Use: Firstly, open your favorite browser and type the following:
http://[PI_ADDRESS]:9000 # If you don't remember your PI's IP address, type: hostname -I
Secondly, upon launching Portainer’s web interface, you will need to create an admin account.
What sort of container environment we want Portainer to manage? Select Docker. Click on Containers and you will be presented with a list of containers currently set up on your device. If you want to add a new one, click the Add container button.
If you’ve used Arch Linux, you’re probably familiar with how easy it is to alter or even break your system inadvertently. However, containerized environments provide a reliable solution: you can set up containers for specific tasks, isolating applications and configurations to keep your system intact.
sudo pacman -S distrobox podman # Distrobox allows you to create and manage containers on your favorite Linux distribution using either Docker or Podman.
Using Distrobox as a native user space environment is an excellent way to keep your system clean and stable, particularly if you’re not yet ready to switch to an immutable Linux desktop. Remember, with mutable systems, any changes or configuration drifts are permanent!
Create, enter, and manage containers effortlessly with Distrobox commands:
distrobox create -i archlinux # Create a Container from an image (in this case, Arch Linux)
distrobox enter archlinux # Access a Distrobox Container or use: distrobox-enter --name container-name
Once inside the container, you can install and update applications without affecting the host system. Here are a few commands to get you started:
sudo pacman -S vlc flameshot neofetch # Install apps within the container
sudo pacman -Syu gimp # Update applications in the container
sudo pacman -S libcanberra-pulse # A library for PulseAudio sound server support
If you prefer, you can run commands directly in the Distrobox container without accessing the shell each time: distrobox enter nameContainer ‐‐ distrobox-export ‐‐app nameApp, e.g., distrobox enter archlinux ‐‐ distrobox-export ‐‐app gimp
Make sure you’re running this command from your host system, not from inside the container
Distrobox also provides commands for managing your containers effectively:
distrobox stop archlinux # Stop a container.
distrobox create --name arch2 --clone archlinux # Clone an existing container.
distrobox rm arch2 # Remove a container.
distrobox list # List all containers.
distrobox-upgrade --all # Upgrade all containers' packages.
This last command, distrobox-upgrade ‐‐all, will enter each container, use its package manager, and perform an upgrade for each one.
A frequent error when running GUI applications in a container is “Cannot open display”, which suggests that the GUI application cannot access the X server display. This issue generally arises due to problems with X11 forwarding or lack of permissions to access the X server.
To resolve this issue, ensure that your user is permitted to connect to the X server:
sudo pacman -S xorg-xhost # Install xorg-xhost.
vim .zshrc: # Open the .zshrc file in Vim
xhost +si:localuser:$USER
Open your .zshrc
file to include the command xhost +si:localuser:$USER
.