JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

Docker, docker compose, Portainer. Distrobox.

Introduction

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. Image

  1. First, we will update and upgrade the system: sudo apt-get update && sudo apt-get upgrade
  2. Let’s install Docker using the following command: sudo apt install docker.io. Let’s know the Docker version information: docker ‐‐version. Check whether Docker is running: sudo systemctl status docker
  3. We should start Docker and make it enable automatically on system boot: sudo systemctl enable ‐‐now docker.
  4. Add your user to the docker group: sudo usermod -aG docker ${USER}.
  5. It’s time to test it: docker run hello-world.
  6. List all Docker containers: docker container ls -a. Stop a specific container: docker container stop [container_id] or all containers: docker container stop $(docker container ls –aq). Remove a stopped container: docker container rm [container_id] or all containers: docker container rm $(docker container ls –aq).
  1. First, we will update and upgrade the system: sudo apt-get update && sudo apt-get upgrade
  2. Download (curl) and execute the installation script: curl -sSL https://get.docker.com​ | sh
  3. Add a non-root user (pi) to the docker group: sudo usermod -aG docker pi
  4. Check Docker version (docker version) and test it by running the Hello World container: docker run hello-world
  1. Install the necessary packages: sudo pacman -Syy docker docker-compose
  2. Start the docker service on startup: sudo systemctl start docker.service, sudo systemctl enable docker.service
  3. Add our user to the Docker group: sudo usermod -aG docker $USER
  4. Test it: docker run hello-world

Docker compose

Docker compose is a tool for running multi-container applications on Docker.

  1. Let’s install it. First, we need to install some dependencies: sudo apt-get install -y libffi-dev libssl-dev. sudo apt-get install -y python3 python3-pip. sudo apt-get remove python-configparser. Next, we install docker compose: sudo pip3 -v install docker-compose.
  2. List all running Docker containers: sudo docker ps. List all containers, both running and stopped: sudo docker ps –a.
  3. Delete containers: docker rm IdContainer. Delete all “exited” containers: docker container prune.
  4. Start a stopped docker container: docker start IdContainer. Start a container in interactive mode: docker run -it ubuntu.

Portainer

Portainer is a lightweight management UI witch allows you to easily create, manage, and delete your Docker containers

  1. 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.

  2. 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.

Distrobox

If you have used Arch Linux, then you definitely know how easy it is to mess up your system. With containerized systems, you can create each one for a specific task.

    sudo pacman -S distrobox podman # Distrobox allows you to create and manage containers on your favorite Linux distribution using either Docker or **Podman**.

You may have an error, “Cannot open display,” indicates that GIMP is unable to access the X server display. This issue typically arises when there’s a problem with X11 forwarding or permissions to access the X server.

    sudo pacman -S xorg-xhost
    vim .zshrc: xhost +si:localuser:$USER

Edit the .zshrc file to include the command xhost +si:localuser:$USER. It allows your user to access the X server using the xhost utility (sudo pacman -S xorg-xhost).

The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server. This command grants permission to the current user to connect to the X server: xhost +si:localuser:$USE where the command consists: 1) xhost + 2) with local user authorization si:localuser:$USER

distrobox create -i archlinux # Create a Container from an Image
distrobox enter archlinux # Access a Distrobox Container, distrobox-enter --name container-name
sudo pacman -S vlc flameshot neofetch
sudo pacman -Syu gimp
sudo pacman -S libcanberra-pulse # A library that allows applications to play event sounds through the PulseAudio sound server by providing support for PulseAudio

You may want to directly run the commands on a Distrobox container instead of accessing the container. Exporting Applications from Container to Host. Access the container’s shell (distrobox-enter –name container-name – command), then distrobox-export ‐‐app name_app, e.g., distrobox-export ‐‐ app vlc.

distrobox stop archlinux  # Stop an image.
distrobox create --name arch2--clone archlinux  # Clone an image.
distrobox rm arch2 # Remove an image.
distrobox-list  # List Images.
distrobox upgrade --all # Upgrade all images.
Bitcoin donation

JustToThePoint Copyright © 2011 - 2024 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.