Using docker requires installation; Docker is an open source application container engine. To install Docker on liunx, the operating system requires a 64-bit operating system, and the kernel version needs to be 3.10 or above. Install docker on CentOS. Then use CentOS 7.0 to meet the requirements for installation.
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
Docker needs to be installed?
CentOS Docker installation
Use the official installation script to install automatically
The installation command is as follows:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
You can also use the domestic daocloud one-click installation command:
curl -sSL https://get.daocloud.io/docker | sh
Manual installation
Uninstall the old version
Older versions of Docker are called docker or docker-engine. If these programs are installed, uninstall them and their associated dependencies.
$ sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
Install Docker Engine-Community
Installation using Docker repository
Before installing Docker Engine-Community for the first time on a new host, you need to set up Docker storehouse. Afterwards, you can install and update Docker from the repository.
Set up the repository
Install the required packages. yum-utils provides yum-config-manager, and the device mapper storage driver requires device-mapper-persistent-data and lvm2.
$ sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2
Use the following commands to set up a stable repository.
Use the official source address (relatively slow)
$ sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
You can choose some domestic source addresses:
Alibaba Cloud
$ sudo yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Tsinghua University source
$ sudo yum-config-manager \ --add-repo \ https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
Install Docker Engine-Community
Install the latest version of Docker Engine-Community and containerd, or go to the next step to install a specific version:
$ sudo yum install docker-ce docker-ce-cli containerd.io
If prompted You accept GPG keys, please select Yes.
Are there multiple Docker repositories?
If multiple Docker repositories are enabled, the installation or update performed without specifying a version in the yum install or yum update command will always install the highest version, which may not be suitable for your stability need.
Docker is not started by default after installation. And the docker user group has been created, but there are no users under this user group.
To install a specific version of Docker Engine-Community, list the available versions in the repository, then select and install:
1. List and sort the versions available in your repository . This example sorts the results by version number (highest to lowest).
$ yum list docker-ce --showduplicates | sort -r docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
2. Install a specific version by its complete package name, which is the package name (docker-ce) plus the version string (second column), starting with the first colon ( :) up to the first hyphen, separated by a hyphen (-). For example: docker-ce-18.09.1.
$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
Start Docker.
$ sudo systemctl start docker
Verify that Docker Engine-Community is installed correctly by running the hello-world image.
$ sudo docker run hello-world
Uninstall docker
Delete the installation package:
yum remove docker-ce
Delete images, containers, configuration files, etc.:
rm -rf /var/lib/docker
Recommended Study: "docker video tutorial"
The above is the detailed content of Does docker need to be installed?. For more information, please follow other related articles on the PHP Chinese website!

Using Docker on Linux can improve development efficiency and simplify application deployment. 1) Pull Ubuntu image: dockerpullubuntu. 2) Run Ubuntu container: dockerrun-itubuntu/bin/bash. 3) Create Dockerfile containing nginx: FROMubuntu;RUNapt-getupdate&&apt-getinstall-ynginx;EXPOSE80. 4) Build the image: dockerbuild-tmy-nginx. 5) Run container: dockerrun-d-p8080:80

Docker simplifies application deployment and management on Linux. 1) Docker is a containerized platform that packages applications and their dependencies into lightweight and portable containers. 2) On Linux, Docker uses cgroups and namespaces to implement container isolation and resource management. 3) Basic usages include pulling images and running containers. Advanced usages such as DockerCompose can define multi-container applications. 4) Debug commonly used dockerlogs and dockerexec commands. 5) Performance optimization can reduce the image size through multi-stage construction, and keeping the Dockerfile simple is the best practice.

Docker is a Linux container technology-based tool used to package, distribute and run applications to improve application portability and scalability. 1) Dockerbuild and dockerrun commands can be used to build and run Docker containers. 2) DockerCompose is used to define and run multi-container Docker applications to simplify microservice management. 3) Using multi-stage construction can optimize the image size and improve the application startup speed. 4) Viewing container logs is an effective way to debug container problems.

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

The methods to view Docker logs include: using the docker logs command, for example: docker logs CONTAINER_NAME Use the docker exec command to run /bin/sh and view the log file, for example: docker exec -it CONTAINER_NAME /bin/sh ; cat /var/log/CONTAINER_NAME.log Use the docker-compose logs command of Docker Compose, for example: docker-compose -f docker-com

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

Four ways to exit Docker container: Use Ctrl D in the container terminal Enter exit command in the container terminal Use docker stop <container_name> Command Use docker kill <container_name> command in the host terminal (force exit)


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version
Useful JavaScript development tools