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

What is the method of docker calling the container

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What is the method that docker calls the container? Perform the docker operation of the host in docker, which we call docker in docker. Operating the docker of the host in docker can not only deploy your specific needs into containers, but also do not have to install it directly on the host (assuming we have no way to operate the docker of the host in docker, then we can only install such software programs directly on the host, which is obviously not conducive to management and maintenance).

To achieve this requirement, it is very simple. You only need to mount the docker file and docker.sock file of the docker host into the container, specifically as follows:

-v / var/run/docker.sock:/var/run/docker.sock-v / usr/bin/docker:/usr/bin/docker

You need to find the docker and docker.sock location of the host first, don't mount it wrong, the standard Linux is normally the above location.

When you start the docker container, after you mount the above two files normally, you can execute commands such as docker images in docker.

If there is a problem, permission denied

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sockdial unix / var/run/docker.sock: connect: permission denied

Solution method

Give docker.sock 777 permission directly on the host where the container is located, and command chmod 777 docker.sock

So much for sharing the method of docker calling container. I hope the above content can be of some reference value and can be put into practice. If you like this article, you might as well share it for more people to see.

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