Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
install_docker [2024/02/08 18:31] – systeminstall_docker [2026/09/10 23:34] (current) – [Working with the Docker containers] system
Line 7: Line 7:
  
 ===== Install Docker ===== ===== Install Docker =====
-  * We assume that you are a user-named **system** on a standard Ubuntu installation. +  * We assume that you are a user named **system** on a standard Ubuntu 26.04 installation. 
-  * Enter the following commands to install the Docker system on your computer.+  * Set up the Docker repository: 
 +<code bash> 
 +# Add Docker's official GPG key: 
 +sudo apt update 
 +sudo apt install -y ca-certificates curl 
 +sudo install -m 0755 -d /etc/apt/keyrings 
 +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc 
 +sudo chmod a+r /etc/apt/keyrings/docker.asc 
 + 
 +# Add the repository to Apt sources: 
 +sudo tee /etc/apt/sources.list.d/docker.sources <<EOF 
 +Types: deb 
 +URIs: https://download.docker.com/linux/ubuntu 
 +Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") 
 +Components: stable 
 +Architectures: $(dpkg --print-architecture) 
 +Signed-By: /etc/apt/keyrings/docker.asc 
 +EOF 
 + 
 +sudo apt update 
 +</code> 
 +  * Install the Docker packages: 
 +<code bash> 
 +sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin 
 +</code> 
 +  * Manage Docker as a non-root user:
 <code bash> <code bash>
 USER="system" USER="system"
 +sudo usermod -aG docker $USER
 +</code>
 +  * After running this, you must log out and log back in //(or run newgrp docker)// for the group changes to take effect.
 +  * Verify the install
 +<code bash>
 +docker --version
 +docker compose version
 +docker run hello-world
 +#---- This was the output ---
 +Unable to find image 'hello-world:latest' locally
 +latest: Pulling from library/hello-world
 +4f55086f7dd0: Pull complete 
 +d5e71e642bf5: Download complete 
 +Digest: sha256:5e23090353324d887c48ad5e5c56d294eab81588df9605b07d1afe895f9cc8f8
 +Status: Downloaded newer image for hello-world:latest
  
-sudo apt-get update +Hello from Docker! 
-sudo apt-get install -y \ +This message shows that your installation appears to be working correctly.
-    ca-certificates \ +
-    curl \ +
-    gnupg \ +
-    lsb-release+
  
-sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg+To generate this message, Docker took the following steps: 
 + 1. The Docker client contacted the Docker daemon. 
 + 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 
 +    (amd64) 
 + 3. The Docker daemon created a new container from that image which runs the 
 +    executable that produces the output you are currently reading. 
 + 4. The Docker daemon streamed that output to the Docker client, which sent it 
 +    to your terminal.
  
-echo \ +To try something more ambitious, you can run an Ubuntu container with: 
-  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $ docker run -it ubuntu bash
-  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null+
  
-sudo apt-get update +Share images, automate workflows, and more with a free Docker ID: 
-sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin + https://hub.docker.com/
-sudo apt-get -y install docker-compose+
  
-# Make docker run as non root +For more examples and ideas, visit: 
-sudo usermod -aG docker $USER + https://docs.docker.com/get-started/
-sudo chmod 666 /var/run/docker.sock+
  
-# customize it with your own. 
-sudo mkdir -p /mnt/data 
-# make sure all future data in this folder can be created as non root 
-sudo chown  $USER:$USER /mnt/data 
 </code> </code>
 +
 +<WRAP center round tip 100%>
 +===== Starting with a clean slate =====
 +  * You might have some existing docker containers and images that you first want to get rid of.
 +  * **Use these instructions with caution**. It might destroy items you do not want to destroy.
 +<code bash>
 +#Only run these commands if you want to start with a full clean slate
 +docker stop $(docker ps -a -q)
 +docker rm $(docker ps -a -q)
 +docker network rm radiusdesk-bridge 
 +</code>
 +</WRAP>
  
 ===== Create the Docker containers ===== ===== Create the Docker containers =====
-  * Everything you need to create the RADIUSdesk Docker containers is provided with the RADIUSdesk (rdcore) repository.+  * Everything you need to create the RADIUSdesk Docker containers are provided by the **rdcore** and **rd_cake5** repositories.
   * Check out the **rdcore** git repository.   * Check out the **rdcore** git repository.
 <code bash> <code bash>
 cd ~ cd ~
 sudo git clone https://github.com/RADIUSdesk/rdcore.git sudo git clone https://github.com/RADIUSdesk/rdcore.git
 +</code>
 +  * Check out the **rd_cake5** git repository.
 +<code bash>
 +cd ~
 +sudo git clone https://github.com/RADIUSdesk/rd_cake5.git
 </code> </code>
   * Mount the rdcore top directory to the **rdcore/docker/rdcore** directory   * Mount the rdcore top directory to the **rdcore/docker/rdcore** directory
Line 52: Line 105:
 sudo mount --bind ../../rdcore ./rdcore sudo mount --bind ../../rdcore ./rdcore
 </code> </code>
-  * Run the **local_build.sh** script.+  * Mount the rd_cake5 directory to the **rdcore/docker/rd_cake5** directory 
 +<code bash> 
 +sudo mkdir rd_cake5 
 +sudo mount --bind ../../rd_cake5 ./rd_cake5 
 +</code> 
 +  * Execute the script local_build.sh.
 <code bash> <code bash>
 ./local_build.sh ./local_build.sh
Line 71: Line 129:
 </alert> </alert>
  
-  * After it completed you can confirm it is running+  * After the process is complete, you can confirm that it is running
 <code bash> <code bash>
 docker container ls docker container ls
Line 78: Line 136:
 db3c6fa81d8b   bitnami/mariadb:10.5   "/opt/bitnami/script…"   2 hours ago         Up 2 hours         3306/t db3c6fa81d8b   bitnami/mariadb:10.5   "/opt/bitnami/script…"   2 hours ago         Up 2 hours         3306/t
 </code> </code>
-  * Open a browser and go to the IP Address of the host running the docker containers.+  * Open a browser and call up the IP address of the host on which the Docker containers are running.
  
 +
 +===== Working with the Docker containers =====
 +  * The docker containers can be seen as a lightweight Linux machine.
 +==== Who is active? ====
 +
 +  * To see which docker containers are running:
 +<code bash>
 +docker ps
 +#This was the reply on my machine
 +CONTAINER ID   IMAGE               COMMAND                  CREATED             STATUS          PORTS                                                                                                  NAMES
 +5c99a3eb667b   docker-radiusdesk   "/bin/sh -c '/usr/bi…"   About an hour ago   Up 39 minutes   0.0.0.0:80->80/tcp, [::]:80->80/tcp, 0.0.0.0:1812-1813->1812-1813/udp, [::]:1812-1813->1812-1813/udp   radiusdesk
 +881209d31244   mariadb:11.8        "docker-entrypoint.s…"   About an hour ago   Up 39 minutes   3306/tcp                                                                                               radiusdesk-mariadb
 +</code>
 +==== Shell access ====
 +  * If you like the Linux shell then you will feel at home inside a Docker container.
 +  * You can shell into the radiusdesk container with the following command:
 +<code bash>
 +docker exec -it radiusdesk bash
 +</code>
 +  * To make a backup of the DB you can issue:
 +<code bash>
 +mysqldump -h radiusdesk-mariadb -u rd -p --events rd > /tmp/rd.sql
 +</code>
 +  * There are also a vi editor and the ping command installed for basic editing and network troubleshooting.
 +  * To exit out of the docker container simply type **exit**.
 +  * You can shell into the radiusdesk-mariadb container with the following command:
 +<code bash>
 +docker exec -it radiusdesk-mariadb bash
 +</code>
 +==== Log output ====
 +  * Again if you like the fact that you can check log files to confirm everything works well then Docker containers got you covered.
 +  * You can run the following command to check the log output of the radiusdesk container:
 +<code bash>
 +docker logs radiusdesk --tail 20 -f
 +</code>
 +  * For the log output of radiusdesk-mariadb:
 +<code bash>
 +docker logs radiusdesk-mariadb --tail 20 -f
 +</code>
  • install_docker.1707409891.txt.gz
  • Last modified: 2024/02/08 18:31
  • by system