Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How the docker container runs the software

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "how the docker container runs the software". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how the docker container runs the software.

Think of the docker image as a computer without a monitor. The program can run, but there is no place to display it. At present, X11, the mainstream image interface service of linux, supports the working mode of client / server (Client/Server). As long as "unix: Port" or "hostname: Port" is shared with docker,docker when the container is started, the output can be found through the port and shared with the linux system.

1) run in the main system

$sudo apt-get install x11MusxserverMutil $xhost +

The function of these two sentences is to open permissions and allow all users, including docker, to access the display interface of X11.

2) when starting the docker container, add the following options:

-v / tmp/.X11-unix:/tmp/.X11-unix\ # shared local unix port-e DISPLAY=unix$DISPLAY\ # modify environment variable DISPLAY-e GDK_SCALE\ # these two environment variables should be related to the display effect-e GDK_DPI_SCALE\

The final startup command looks like this

$docker run-d\-v / etc/localtime:/etc/localtime:ro\-v / tmp/.X11-unix:/tmp/.X11-unix\-e DISPLAY=unix$DISPLAY\-e GDK_SCALE\-e GDK_DPI_SCALE\-- name libreoffice\ jess/libreoffice

In this way, after the startup of the container, the program with a graphical interface can be displayed freely, just like it is displayed locally.

This operation is already very convenient. It should be noted that every time you restart the computer, you need to operate it on the local machine.

Xhost +

Turn on permissions.

At this point, I believe you have a deeper understanding of "how the docker container runs the software". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report