In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is about an example analysis of docker system management in python. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
What is Docker Hub?
Docker Hub is a repository.
>https://hub.docker.com/
If the page cannot be opened, then ××× is required.
A repository is a centralized repository of mirrored files.
Warehouses are public and private.
The largest public repository is hub.docker.com/
Users can also set up private repositories on their local network.
Users can selectively upload images to private and public repositories. Other users only need pull command to use mirror, upload is through push command
note
> Download does not require an account, upload requires an account registration
vagrant install docker
Source code: github.com/limingios/dockerpython.git (Docker Docker Python System Management-Basic Concepts (27))
Use of vagrant. See Synonyms at vagrant
mac install vgarant: idig8.com/2018/07/29/docker-zhongji-07/
window install vgarant: idig8.com/2018/07/29/docker-zhongji-08/
Install centos7 via vagrant
Vagrantfile
# -*- mode: ruby -*-# vi: set ft=ruby :Vagrant.require_version ">= 1.6.0"boxes = [ { :name => "docker-vagrant-centos", :mem => "2048", :cpu => "2" }]Vagrant.configure(2) do |config| config.vm.box = "centos/7" boxes.each do |opts| config.vm.define opts[:name] do |config| config.vm.hostname = opts[:name] config.vm.provider "vmware_fusion" do |v| v.vmx["memsize"] = opts[:mem] v.vmx["numvcpus"] = opts[:cpu] end config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--memory", opts[:mem]] v.customize ["modifyvm", :id, "--cpus", opts[:cpu]] end config.vm.network :private_network, auto_config: true, ip: "192.168.70.100", bridge:"ens1f0", bootproto: "static", gateway: "192.168.70.1" end end config.vm.provision "shell", privileged: true, path: "./ setup.sh"end
setup.sh
#/bin/shsudo yum install -y yum upgrade yum-utils device-mapper-persistent-data wgetsudo yum install -y net-toolssudo yum install -y curl policycoreutils openssh-server openssh-clientssudo systemctl enable sshdsudo systemctl start sshdsudo yum install -y postfixsudo systemctl enable postfixsudo systemctl start postfixsudo firewall-cmd --permanent --add-service=httpsudo systemctl reload firewalldsudo curl -sSL https://get.docker.com/ | shsudo curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://b81aace9.m.daocloud.iosudo systemctl restart dockersudo yum -y install epel-releasesudo yum -y install python-pipsudo yum clean allsudo pip install docker-compose
vagrant installation command
vagrant up
mac install vgarant: idig8.com/2018/07/29/docker-zhongji-07/
window install vgaranthttps://idig8.com/2018/07/29/docker-zhongji-08/
System Type IP Address Node Role CPUMemoryHostnameCentos7192.168.70.100gitlab22Gdocker-vagrant-centos
(1). Virtual machine vagrant explains the steps of installation
vagrant up
(2). Machine window/mac Open remote login under root user
su -#Password vagrant#Set PasswordAuthentication yesvi /etc/ssh/sshd_configsudo systemctl restart sshd
docker login
> Log in via web page
Virtual machine linux login docker official website, enter the username and password. It's not an email registered on the official website.
docker login
Search Mirrors
> Official website
Linxu command mode
download mirror
>1. Configure the accelerator first
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.iosudo systemctl restart docker
2. Download centos mirror
#Default download last version docker pull centosdocker images
3. 75MB Centos Mirrors, Why? Usually download centos ios are a few G, how can it be so small. If Old Tie was a beginner, he would definitely ask such questions.
Explain why the mirror is so small.
>Linux operating system is composed of kernel space and user space. Kernel space is kernel. Linux will load this bootfs file system when it is just started. After that, this bootfs file system will be unloaded. The user file system is rootfs, including dev, bin and other directories. For the centos image just downloaded, the bottom layer will use docker kernel. You only need to provide user space. For a streamlined system, user space can be very small. Just need to include the most basic commands and libraries can be, we usually install centos in addition to the most basic will install a lot of software, services, graphics desktop and so on, need several g is not surprising.
What is a mirror image?
Docker image is a special file system, in addition to providing programs, libraries, resources, configuration files, etc. required by the container runtime, it also contains some configuration parameters prepared for runtime (such as anonymous volumes, environment variables, users, etc.). Mirrors do not contain any dynamic data, and their contents remain unchanged after they are built. docker image only needs a basic base Image, which can be continuously superimposed according to the needs. Share a basic. A base image has multiple containers, if the etc file in the container is modified, but the base image is unchanged. Modifications are made only within a single container. For example, to install a tomcat image, the new image is stacked one layer below the base linux.
Docker's copy-on-write feature
All modifications, additions, and deletions occur only in the container layer, and the mirror layer is read-only.
What is a container?
A container is a lightweight, portable, self-contained software packaging technology that is an application that can run the same way almost anywhere.
Developers create and test containers on their own laptops that run on production virtual machines, physical servers, or public cloud hosts without any modifications.
Why containers are needed and why they are called containers
Container, no matter what kind of cargo you are, piano, banana, Porsche, he will be placed in their respective containers, it will be sealed, only to reach the destination will be opened, standard containers will be efficient loading and unloading overlap, long-distance transportation. Docker applies the container idea to packaging software. It provides a standardized shipping system for containers for code. Docker packages any application into a lightly dependent, portable, self-contained container that can run on almost any operating system. In fact, the corresponding words for containers and containers are called containers. Docker's icon is a whale holding multiple containers.
Advantages of docker containers
The advantage of containers is that for developers, they can be created once and run anywhere, and for operation and maintenance personnel, they can be configured once and run all applications.
Docker service
Docker's core background process, which is responsible for responding to requests from Docker clients and then translating these requests into system calls to complete container management operations. This process starts an API Server in the background that receives requests sent by Docker clients; received requests are dispatched through a route within Docker services, and then specific functions execute the requests.
Thank you for reading! About "Python docker system management example analysis" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.