What to do if docker fails to install nginx

藏色散人
Release: 2021-12-13 13:48:54
Original
3089 people have browsed it

Solution to the failure of docker to install nginx: 1. Delete the originally installed nginx container through "docker rm nginx"; 2. Delete the nginx image file; 3. Reinstall and start nginx.

What to do if docker fails to install nginx

The operating environment of this article: ubuntu 18.04 system, Docker version 20.10.11, Dell G3 computer.

What should I do if docker fails to install nginx?

Error—Docker installs nginx and reports an error

Docker reported an error when installing nginx

What to do if docker fails to install nginx
I tried uninstalling docker and reinstalling it, deleting nginx, and deleting the nginx image file to no avail. Finally, I found that the Linux and docker version compatibility issues

1、查看你当前的内核版本         
uname -r

2、更新yum包               
sudo yum update

3、卸载已安装的docker(如果安装过的话)      
yum remove docker  docker-common docker-selinux docker-engine

4、安装需要的软件包           
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

5、设置yum源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

6、可以查看所有仓库中所有docker版本,并选择特定版本安装
yum list docker-ce --showduplicates | sort -r

7、重新安装docker
sudo yum install docker-ce

8、启动docker
sudo systemctl start docker

9、验证安装是否成功
docker virsion      #查看docker的版本
docker ps            #查看当前正在运行的容器

10、删除原本装好的nginx容器(如果安装过)
docker rm nginx(容器名字或者id)

11、删除nginx镜像文件
docker images      #查看镜像文件
docker rmi nginx   #删除nginx镜像
docker rmi -f nginx     #强制删除nginx镜像

12、重装并启动nginx
docker run --name nginx -d -p 80:80 nginx

13、安装成功,测试成功
Copy after login

Recommended study: "Docker Video Tutorial"

The above is the detailed content of What to do if docker fails to install nginx. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!