In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Experimental environment:
centos7 64-bit ubuntu16.04 64-bit (for testing private repositories)
This article is divided into four parts:
Part 1: Installing docker
Part 2: Operation of Mirrors
Part 3: Handling of containers
Part 4: Creating a Private Repository
Part 1: Installing docker
#install dockersudo via yum source yum -y install docker#start dockersudo systemctl start docker#boot sudo systemctl enable docker
Part 2: Operation of Mirrors
Find and download docker images (for example centos)
#find centos mirror docker search centos#download centos mirror sudo docker pull docker.io/centos:latest
List Mirrors
sudo docker image ls
removing mirroring
sudo docker image rm 4655e9997674
Part 3: Handling of containers
Create container and enter
sudo docker run -t -i --name zhaoolee-centos docker.io/centos:latest /bin/bash
Parameter description: -t Assign a pseudo-terminal and bind it to the container's standard input, -i Leave the container's standard input open
View all containers
sudo docker ps -a
start the container
sudo docker start zhaoolee-centos
View currently running containers
sudo docker ps
stop the container
sudo docker stop zhaoolee-centos
Enter container environment
sudo docker attach zhaoolee-centos
Send commands inside the container
We can send commands inside the container without going into the container environment
sudo docker exec zhaoolee-centos touch 123.txt
delete a container
After stopping the container, you can delete the container
sudo docker rm zhaoolee-centos
(Optional)docker Advanced Command
Exchange files docker cp
The docker cp command enables file exchange between containers and external environments.
We create a new 123.txt file inside the docker container, copy it to the external environment, create a new 456.txt file in the external environment and copy it to the docker container (as shown below)
Even if the container is inactive, it is still possible to exchange files
Publish modified container as mirror
#Publish the modified container as an image, `-a` indicates the author, `-m` indicates the description of this modification sudo docker commit -a "zhaoolee" -m "add 123.txt 456.txt" zhaoolee-centos Zhaoolee-centos:0.1#Create a container based on the new image sudo docker run -t -i --name my-centos zhaoolee-centos:0.1 /bin/bash
View mirrored information
#View newly created mirror information sudo docker history zhaoolee-centos:0.1
View change logs within containers
sudo docker diff zhaoolee-centos
View Mirrors and Container Details
#View details of mirror sudo docker inspect zhaoolee-centos:0.1 #View details of container sudo docker inspect zhaoolee-centos
Part 4: Creating a Private Repository
1. Download an image of the private repository registry server
sudo docker pull registry:latest
2. Create a registry server container
sudo docker run -d -p 5000:5000 --name server-registry -v /tmp/registry:/tmp/registry docker.io/registry:latest
Parameter description-d container runs on the backend, -p 5000:5000 runs on port 5000 of the container and maps to port 5000 of the external system, --name server-registry container Name server-registry, -v /tmp/registry /tmp/registry Mount the host directory/tmp/registry to the container directory/tmp/registry
3. Label local mirrors and place them in local repositories
Label local mirrors
sudo docker tag zhaoolee-centos:0.1 localhost:5000/zhaoolee-centos:0.1
Push marked local images to repository
sudo docker push localhost:5000/zhaoolee-centos:0.1
4. Testing the availability of local repositories
In the virtual machine intranet, start another ubuntu16.04 virtual machine, unbutu16.04 try to get the image just created from centos7 Zhaoolee-centos:0.1
sudo docker pull 192.168.214.156:5000/zhaoolee-centos:0.1
#Fix problems during installation: Fix: Error response from daemon: Get https://192.168.214.156:5000/v2/: http: server give HTTP response to HTTPS clientecho '{ "insecure-registries":["192.168.214.156:5000"] }' >/etc/docker/daemon. json
docker is an emerging virtualization method, which is more efficient than traditional virtual machine technology in terms of execution speed, memory consumption or file storage speed. docker itself supports git-like operations, making iterative deployment of applications simpler and more efficient. For some very complex applications, we can download docker versions directly, out of the box, saving time and effort, and creating more opportunities for lazy operation and maintenance personnel ~
The above is all the content of this article, I hope to help everyone's study, but also hope that everyone a lot of support.
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.