Table of Contents
Docker and its differences from a virtual machine
Docker is a software solution used for automatic deployment and management of applications in the environments that support containers. This solution makes it possible to “pack” an application with all its environment and dependencies in a container that may be later deployed. Docker offers a set of commands for managing these containers.
Docker and virtual machines have a similar purpose, but they interact with the operating system in different ways. The main distinction is that a virtual machine offers an additional abstraction layer over the real hardware and drivers while a Docker container directly interacts with the hardware of the host machine.
What is TrueConf VideoSDK?
TrueConf VideoSDK is a software solution for creating enterprise-level applications with integrated TrueConf video conferencing. It serves as the basis for TrueConf Room which means that TrueConf Room can be viewed as TrueConf VideoSDK with a full-featured web interface for managing video conferences. Check here to learn more about TrueConf VideoSDK and its differences from TrueConf Room. TrueConf also provides a NuGet package to support .NET development. To learn more about this package, check here.
This toolkit helps developers create high-quality applications and facilitates the development process. With TrueConf VideoSDK, one can integrate video conferencing technologies into self-service or information kiosks and enterprise-based software.
Limitations of TrueConf VideoSDK within a container
The features of VideoSDK on a local machine and within a container are almost identical. The only difference is that the latter does not have Front-End. In other words, the main application screen and the conference layout cannot be displayed on a monitor. This issue is related to the restrictions imposed by containers.
How to deploy a container with VideoSDK on my PC
This example will show how to install and configure Docker and deploy a container on Debian 12. The content of the container will be TrueConf VideoSDK version 4.3.
To install Docker on your OS:
- Update the list of packages, to do it run this command in the terminal:
- Run this command to install additional packages required for working with remote repositories:
- Download and add the PGP key from the Docker repository. To do it, run this command:
- Run this command to add a Docker repository:
- Update the lists of available packages:
- Install Docker and additional packages with this command:
1 |
sudo apt update |
1 |
sudo apt -y install ca-certificates curl gnupg lsb-release |
1 |
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg |
1 |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
1 |
sudo apt update |
1 |
sudo apt -y install docker-ce docker-ce-cli containerd.io |
Launch and automatic startup of Docker
By default, Docker is disabled after installation. To launch it, run this command:
1 |
sudo systemctl start docker |
To add Docker to the automatic startup, execute the command:
1 |
sudo systemctl enable docker |
Adding a user to a Docker group
By default, Docker is available only to the root user: if a Docker command is run by a regular user, an error message will be displayed in the terminal. To run Docker commands on behalf of a regular user without the sudo command, one should add the current user to the docker group which is created automatically during installation. Run this command to check if the group is available:
1 |
groups $USER |
If this group was not created automatically due to some reason, one has to create it manually. To do it, run this command:
1 |
sudo groupadd docker |
Next, to add the current user to the docker group, execute the command:
1 |
sudo usermod -aG docker user_name |
, where user_name
is the name of the user who should be added to the docker group. To check the result, execute the command:
1 |
docker ps |
This command displays the list of launched containers.
Launching the first container
To make sure that Docker was installed correctly, mount a test image. For this purpose, execute the command:
1 |
docker run hello-world |
This command will mount the program image from the Docker hub online repository (official Docker registry of software images which is used by default) and run it automatically. If Docker was installed and configured correctly, the phrase “Hello from Docker” will be displayed.
How to build a container with VideoSDK
Building a container
A container is created at the time of its launch. These processes are started with the command:
1 |
docker run |
The utility program has to be given the image on the basis of which the container will be created as well as the Dockerfile, the configuration file that will include the instructions for creating the image. The image can be either local (stored on the computer) or point to the image that should be downloaded from the network (Docker hub and others). In this case, the image stored locally will be used.
Download VideoSDK from our GitHub; please note that the option with Ubuntu 22.04 has to be selected.
Click on the button below to download the archive with the Dockerfile.
One should keep in mind that by default the processes within the container work on behalf of the root user, however, it is dangerous to work under the root account because this user cannot be restricted in any way. To make sure that no threats are posed to the local machine from inside the container, you need to create a user with the standard set of permissions when building the container.
In this example, Dockerfile and VideoSDK image are in the same directory (/home/$USER/dockerresources/videosdk); otherwise, you need to specify the Dockerfile directory with the -f
flag.The command for creating the container with VideoSDK will look in the following way:
1 |
docker build --build-arg username=sdkuser --build-arg password=123sdk456 -t tcvideosdk /home/$USER/dockerresources/videosdk |
where:
--build-arg username=sdkuser
— user name;--build-arg password=123sdk456
— user password;-t tcvideosdk
— image name;/home/$USER/dockerresources/videosdk
— path to the folder with the Dockerfile and container image.
After the command is executed, the container will start to be built. Information about this entire process will be displayed in the terminal. When build is complete, the following message will be displayed:
[+] Building 1169.1s (12/12) FINISHED
.
Testing build
Run the created container with this command:
1 |
docker run -it -d -p 2222:8080 -p 3333:8765 -p 4444:8766 tcvideosdk:latest |
where:
-it
— connects the interactive tty terminal to the container;-d
— launches the container in the background;-p 3333:8765 -p 4444:8766 tcvideosdk:latest
— sets the ports for a Web socket and http port.
To display the list of launched containers in the terminal, run this command:
1 |
docker ps |
1 2 3 4 5 |
alexadmin@DebDocker1:-5 dockerer run -it -d -p 2222:8080 -p 3333:8765 -p 4444:8766 tcvideosdk:latest f756fb106cedc657a51a90bad8996a03049e67d4a9402919e6b6b7aeada66ab4 alexadmin@DebDocker1:-5 docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1756fb106ced tcvideosdk:latest "sh -c 'supervisord ." 9 seconds ago Up 8 seconds 0.0.0.0:2222->8080/tcp, :::2222->8080/tcp,0.0.0.0:3333->8765/tcp, :::3333->8765/tcp, 0.0.0.0:4444->8766/tcp, :::4444->8766/tcp affectionate_dewdney alexadmin@DebDocker1:-5 |
As it is shown in the screenshot above, the container has been launched successfully, and is displayed in the terminal. Check the availability of 3333 and 4444 ports with this command:
1 |
telnet localhost port |
where port is the port that has to be checked.
1 2 3 4 5 6 7 8 9 10 |
alexadmin@DebDocker 1:~$ telnet localhost 3333 Trying ::1… Connected to localhost. Escape character is ']'. Connection closed by foreign host. alexadmin@DebDocker 1:~$ telnet localhost 4444 Trying : : 1. Connected to localhost. Escape character is Connection closed by foreign host. |
The message “Connected to localhost” is displayed in the terminal, which means that the port is working.
To test the http port and Web socket, make an http request:
1 |
http://10.140.2.233:2222/public/default/config.json |
This request should return the following data:
1 2 3 4 5 6 7 8 9 |
{"config": {"websocket": {"hostname":null, "port":8765}, "http": {"hostname":null, "port":8766} } } |