问题合集整理
Posted Zmac111
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了问题合集整理相关的知识,希望对你有一定的参考价值。
问题合集整理
一、Limux 虚拟机中重启网卡失败(centos7)
问题
[root@localhost ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
解决办法
[root@localhost ~]# systemctl stop NetworkManager
[root@localhost ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
[root@localhost ~]# systemctl restart network
[root@localhost ~]#
二、docker中容器启动时网卡没开启
问题
WARNING: IPv4 forwarding is disabled. Networking will not work.
解决办法
vim /etc/sysctl.conf #添加 net.ipv4.ip_forward = 1
sysctl -p
net.ipv4.ip_forward = 1
systemctl restart docker #重启docker
systemctl restart network #重启网卡
三、安装docker私有仓库报错
问题
ERROR: for registry Cannot create container for service registry: b'Conflict. The container name "/registry" is already in use by container "931086bb24de3f713c6350ff7c1fa4a0d55abb63ca1780432661ce2e1e20af12". You have to remove (or rename) that container to be able to reuse that name.'
ERROR: Encountered errors while bringing up the project.
解决办法
docker-compose down -v
docker rm 已有容器 # 删除所有容器
docker images | awk 'NR >=2 print $3' | xargs docker rmi # 删除所有镜像
重新安装即可
四、docker登录私有仓库报错
问题
解决办法
[root@node01 ~]# systemctl daemon-reload
[root@node01 ~]# systemctl restart docker
[root@node01 ~]# docker login -u admin -p Harbor12345 https://hub.FENG.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
五、清除镜像内存
[root@master ~]# free -m
total used free shared buff/cache available
Mem: 3935 1249 293 11 2393 2269
Swap: 0 0 0
[root@master ~]# cd demo
[root@master demo]# ls
my-deployment.yaml nginx-deployment.yaml nginx-service.yaml
[root@master demo]# echo 1 > /proc/sys/vm/drop_caches
[root@master demo]# echo 2 > /proc/sys/vm/drop_caches
[root@master demo]# echo 3 > /proc/sys/vm/drop_caches
[root@master demo]# free -m
total used free shared buff/cache available
Mem: 3935 1234 2210 11 491 2333
Swap: 0 0 0
[root@master demo]#
以上是关于问题合集整理的主要内容,如果未能解决你的问题,请参考以下文章