前言:玩docker的时候,不小心在linux系统里面装了nginx,然后docker里面也装了nginx
使用nginx时有些混淆,然后
一、docker删除nginx步骤:
1.1、找到容器id
[root@VM-4-7-centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1d526cafca50 nginx "/docker-entrypoint.…" 54 minutes ago Up 19 minutes 0.0.0.0:89->80/tcp, :::89->80/tcp mynignx
1.2、执行删除命令
docker rm -f 1d526cafca50
二、linux删除nginx步骤
2.1、执行删除命令
[root@VM-4-7-centos ~]# yum remove nginx
三、确认nginx是否删除干净
whereis nginx
3.1发现还有残留
[root@VM-4-7-centos ~]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz
3.2找到nginx
find -name nginx
这边有个小坑(执行查找语句时需要进入根目录查找)
#home目录
[root@VM-4-7-centos ~]#
#根目录
[root@VM-4-7-centos /]#
3.3查出nginx目录如下
[root@VM-4-7-centos /]# find -name nginx
./etc/logrotate.d/nginx
./etc/nginx
./usr/share/nginx
./usr/lib64/nginx
./usr/sbin/nginx
./var/log/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/etc/default/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/etc/logrotate.d/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/etc/init.d/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/etc/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/usr/lib/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/usr/share/doc/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/usr/share/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/usr/sbin/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/var/log/nginx
./var/lib/docker/overlay2/921516d73040cfd2a2b225ebf6ac689f0a1a653688a4e891efcda4de69b88963/diff/var/cache/nginx
./var/lib/nginx
四、删除目录
[root@VM-4-7-centos /]# rm -rf /etc/logrotate.d/nginx
删除完成再用
find -name nginx 查一遍