In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the detailed steps of installing Docker under Linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the detailed steps of installing Docker under Linux.
First of all, it is clear that the system I use is Linux CentOS, and there is little difference between different versions of Linux.
1. Install dependency packages
Sudo yum install-y yum-utils device-mapper-persistent-data lvm2
two。 Set Ali Cloud Mirror Source
Because the official image source address of docker is foreign by default, and the speed is very slow, the data source is set to the image of Ali Cloud. Of course, there are other domestic mirror sources, and I will not introduce them one by one here.
Sudo yum-config-manager-- add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3. Install Docker-CE
Docker CE (Community Edition) Community Free Edition, which belongs to the docker engine.
Sudo yum install docker-ce
4. Start Docker-CE
Add start Docker service
Sudo systemctl enable dockersudo systemctl start docker
5. Set up user groups for Docker
The communication between the docker command and the Docker engine is through UnixSocket, but users who have access to UnixSocket can only be accessed by users of the root and docker user groups, so we need to establish a docker user group and add users who need to access docker to this user group.
1. Establish a Docker user group
Sudo groupadd docker
two。 Add current user to docker group
Sudo usermod-aG docker $USER
6.GUI management configuration (optional)
Gui management tools can be installed and used if necessary, without mandatory requirements.
Portainer
Official address: https://portainer.io/install.html (if the foreign address is not accessible to the recommended fq)
Installation commands:
Docker volume create portainer_datadocker run-d-p 9000 9000-v / var/run/docker.sock:/var/run/docker.sock-v portainer_data:/data portainer/portainer
Then access it through your own IP+9000 port
Below you can see your own container, image, and so on.
Introduction to the basic concepts of 7.Docker
Mirror (Image)
It holds the application and the dependent environment needed, such as running runtime and webapp.
Why do I need multiple mirrors? When developing, building, and running containerized applications, we usually have different priorities. By providing different mirrors for these separate tasks
Container (Container)
An instance of the mirror. A container represents a running application, process, or service. It consists of a Docker image, an execution environment, and a standard instruction set. When I need to extend the service, I actually mirror what the mirror runs in the container. Can be seen as a completely isolated box.
A container mirror instance represents a separate process.
Hub
On the platform where images are stored remotely, there are already many created images on hub, such as redis mongodb.
Warehouse (repository)
The place where the warehouse holds the image.
After the image is built, it can be run directly on the current host, but if you need to use the image on other servers, you need a service that centrally stores and distributes the images. The warehouse is such a service.
8.Docker common commands
Docker ps-view all containers that are currently running-a shows including containers that have stopped
Docker pull-pull the image
Docker rmi-after deleting an image, it can be matched directly based on the name of the image or the first letter of tag.
Docker start container_id-- Open the container (here it can be the container id or name)
Docker stop container_id-stop the container (here it can be the container id or name)
Docker rm-Delete containers (only stopped containers can be deleted)
Docker build-use Dockerfile to create a mirror
Docker exec-execute commands in the container, for example: docker exec-it container_id (container name or id) / bin/bash (command or tool to be executed by bin/bash)
Docker logs-View the container log, for example: docker logs-f-t-- tail 10 container_id (container name or id)
Run the container
Docker run-it-- rm-p 8000 rm 80-- name aspnet_sample microsoft/dotnet__
-- name container name, followed by the image path or name
-- delete the container after the rm is run
-p Port Mapping 8000 the port running in the external port 80 mirror maps 8000 to the 80 in the mirror.
-the contents of the it output container command line, that is, the container's own program output, is a bit like running in the foreground on the console.
-d runs in the background as opposed to it.
At this point, I believe you have a deeper understanding of the "detailed steps to install Docker under Linux". 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.
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.