root@69033e222523:~# /etc/init.d/nfs-kernel-server restart * Stopping NFS kernel daemon [ OK ] * Unexporting directories for NFS kernel daemon... [ OK ] mount: /proc/fs/nfsd: permission denied. * Exporting directories for NFS kernel daemon... exportfs: No host name given with /root/share (rw,sync,no_root_squash,no_subtree_check), suggest *(rw,sync,no_root_squash,no_subtree_check) to avoid warning exportfs: /root/share does not support NFS export [fail]
nfs挂载也失败
1 2 3 4 5 6 7 8 9
root@69033e222523:/opt/bin# mount -t nfs -o vers=3,nolock 172.18.170.161:/root/share /mnt/ -v mount.nfs: timeout setfor Mon Jun 26 15:30:08 2023 mount.nfs: trying text-based options 'vers=3,nolock,addr=172.18.170.161' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 172.18.170.161 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 172.18.170.161 prog 100005 vers 3 prot UDP port 55469 mount.nfs: mount(2): Operation not permitted mount.nfs: Operation not permitted
# docker run -ti --name test fedora:25 /bin/bash # echo 512 > /proc/sys/net/core/somaxconn # in docker bash: /proc/sys/net/core/somaxconn: Read-only file system # exit # exit docker, back to host # systemctl stop docker # or stop it with whatever servicemanager you're using
root@69033e222523:/# mount -t nfs -o vers=3,nolock 172.18.170.161:/root/share /mnt/ -v mount.nfs: timeout setfor Mon Jun 26 16:24:35 2023 mount.nfs: trying text-based options 'vers=3,nolock,addr=172.18.170.161' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 172.18.170.161 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 172.18.170.161 prog 100005 vers 3 prot UDP port 55469 root@69033e222523:/# ll /mnt/ total 16 drwxr-xr-x 2 root root 4096 Jun 26 14:33 ./ drwxr-xr-x 1 root root 4096 Jun 13 10:20 ../ -rw-r--r-- 1 root root 2 Jun 26 14:28 a -rw-r--r-- 1 root root 2 Jun 26 14:33 b
root@69033e222523:/# /etc/init.d/nfs-kernel-server restart * Stopping NFS kernel daemon [ OK ] * Unexporting directories for NFS kernel daemon... [ OK ] * Exporting directories for NFS kernel daemon... # 下面这个确实可以加个 `*` 去除掉告警 exportfs: No host name given with /root/share (rw,sync,no_root_squash,no_subtree_check), suggest *(rw,sync,no_root_squash,no_subtree_check) to avoid warning exportfs: /root/share does not support NFS export [fail]
# 作完上面操作之后,内容变成人类易读的样子,在docker启动后, json文件又会变回单行文件 # systemctl start docker # docker start du22 du22 # docker exec -it du22 bash root@69033e222523:/# systemctl status ssh # in docker, now works ● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2023-06-26 19:01:05 CST; 30s ago Docs: man:sshd(8) man:sshd_config(5) Process: 72 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) Main PID: 80 (sshd) CGroup: /docker/69033e22252338879cca59d256e03061c9f2068625a83e755358bdfccbaf94d3/system.slice/ssh.service └─80 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Jun 26 19:01:04 69033e222523 systemd[1]: Starting OpenBSD Secure Shell server... Jun 26 19:01:05 69033e222523 sshd[80]: Server listening on 0.0.0.0 port 22. Jun 26 19:01:05 69033e222523 sshd[80]: Server listening on :: port 22. Jun 26 19:01:05 69033e222523 systemd[1]: Started OpenBSD Secure Shell server.