最近为了整合idea与docker,现在要开放一个对外的端口,但是又不想使用默认的端口2375,因为对外暴露容易被攻击,如果是内网下测试还可以,但如果是自己服务器则不建议使用默认端口,
在操作过程中,使用如下命令修改配置文件的时候
vim /usr/lib/systemd/system/docker.service
提示如下:
E325: ATTENTION
Found a swap file by the name "/usr/lib/systemd/system/.docker.service.swp"
owned by: root dated: Sun Mar 28 15:04:01 2021
file name: /usr/lib/systemd/system/docker.service
modified: YES
user name: root host name: VM-0-15-centos
process ID: 17786 (still running)
While opening file "/usr/lib/systemd/system/docker.service"
dated: Sun Mar 28 16:03:10 2021
NEWER than swap file!
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /usr/lib/systemd/system/docker.service"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/usr/lib/systemd/system/.docker.service.swp"
to avoid this message.
Swap file "/usr/lib/systemd/system/.docker.service.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:
这段话大概意思是,找到了一个后缀为.swp的交换文件,可是去/usr/lib/systemd/system/下将这个删除,然后再去编辑
我使用了如下命令
rm -rf .docker.service.swp
然后再使用命令,则正常了
vim /usr/lib/systemd/system/docker.service