sealer icon indicating copy to clipboard operation
sealer copied to clipboard

Ubuntu18.04 sealer run安装docker之后无法启动!

Open Hello-Linux opened this issue 2 years ago • 6 comments

如标题所示

Hello-Linux avatar Aug 20 '22 06:08 Hello-Linux

sealer 只需要纯净版本的服务器就可以了,会自动安装docker 或者 container ,不需要手动安装容器运行时

zsyaoo avatar Aug 21 '22 10:08 zsyaoo

@zsyaoo 这个你确定是自动安装docker?,我在ubuntu18.04上运行sealer run一直报错提示docker没有运行,重装了系统好几次,结果都是一样,之后我手动安装docker之后sealer run就成功运行了 没有手动安装docker会报这个错误,貌似docker daemon没有启动起来,不知道sealer这边为啥启动docker失败了,手动安装的都是正常启动了

+ cd .
+ REGISTRY_PORT=5000
+ VOLUME=/var/lib/sealer/data/my-cluster/rootfs/registry
+ REGISTRY_DOMAIN=sea.hub
+ container=sealer-registry
+++ pwd
++ dirname /var/lib/sealer/data/my-cluster/rootfs/scripts
+ rootfs=/var/lib/sealer/data/my-cluster/rootfs
+ config=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_config.yml
+ htpasswd=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_htpasswd
+ certs_dir=/var/lib/sealer/data/my-cluster/rootfs/certs
+ image_dir=/var/lib/sealer/data/my-cluster/rootfs/images
+ mkdir -p /var/lib/sealer/data/my-cluster/rootfs/registry
+ load_images
+ for image in "$image_dir"/*
+ '[' -f /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar ']'
+ docker load -q -i /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Usage:
  sealer run [flags]

Examples:

create cluster to your bare metal server, appoint the iplist:
        sealer run kubernetes:v1.19.8 --masters 192.168.0.2,192.168.0.3,192.168.0.4 \
                --nodes 192.168.0.5,192.168.0.6,192.168.0.7 --passwd xxx

docker 日志报错,看是找不到iptables路径,但是我看ubuntu18.04是在/sbin/iptables路径

Aug 21 23:23:06 iZbp1er6 nm   systemd[19388]: docker.service: Failed to execute command: No such file or directory
Aug 21 23:23:06 iZbp1er6mk systemd[19388]: docker.service: Failed at step EXEC spawning /usr/sbin/iptables: No such file or directory
Aug 21 23:23:06 iZbp1er6x06e9di7Z dockerd[19142]: time="2022-08-21T23:23:06.765867239+08:00" level=info msg="Processing signal 'terminated'"
Aug 21 23:23:06 iZbp1er6x6e9di7Z dockerd[19142]: time="2022-08-21T23:23:06.766976744+08:00" level=info msg="Daemon shutdown complete"
Aug 21 23:23:06 iZbp1er6x6n0ce9di7Z dockerd[19142]: time="2022-08-21T23:23:06.767021296+08:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled
Aug 21 23:23:06 iZbp1er6x0n9di7Z dockerd[19142]: time="2022-08-21T23:23:06.767062772+08:00" level=info msg="stopping healthcheck following graceful shutdown" module=libcontainerd
Aug 21 23:23:06 iZbp1er6x0ndi7Z dockerd[19142]: time="2022-08-21T23:23:06.767163129+08:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled
Aug 21 23:23:06 iZbp1er6x0n0cei7Z systemd[1]: docker.service: Control process exited, code=exited status=203
Aug 21 23:23:07 iZbp1er6x6n0ce97Z systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 21 23:23:07 iZbp1er6x6n0cei7Z systemd[1]: Failed to start Docker Application Container Engine.

Hello-Linux avatar Aug 21 '22 14:08 Hello-Linux

@Hello-Linux

There is no doubt that docker will be installed automatically by sealer. While for the below message:

+ docker load -q -i /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I think it is because that docker daemon has failed to startup. In this case, maybe showing more logs about dockerd could be more helpful. If the environment is still there, could you help to show the log of dockerd, maybe the file /var/log/docker.log ?

allencloud avatar Aug 22 '22 02:08 allencloud

@allencloud ### Ubuntu18.04 iptables path is /sbin/iptables,not in /usr/sbin/iptables,sealer should use /sbin/iptables. when I create a link for iptables with run command "ln -sf /sbin/iptables /usr/sbin/iptables", then the sealer run is success!!!!!!!!! so the searler should auto find the iptables path which iptables

Aug 21 23:23:06 iZbp1er6 nm   systemd[19388]: docker.service: Failed to execute command: No such file or directory
Aug 21 23:23:06 iZbp1er6mk systemd[19388]: docker.service: Failed at step EXEC spawning /usr/sbin/iptables: No such file or directory
Aug 21 23:23:06 iZbp1er6x06e9di7Z dockerd[19142]: time="2022-08-21T23:23:06.765867239+08:00" level=info msg="Processing signal 'terminated'"
Aug 21 23:23:06 iZbp1er6x6e9di7Z dockerd[19142]: time="2022-08-21T23:23:06.766976744+08:00" level=info msg="Daemon shutdown complete"
Aug 21 23:23:06 iZbp1er6x6n0ce9di7Z dockerd[19142]: time="2022-08-21T23:23:06.767021296+08:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled
Aug 21 23:23:06 iZbp1er6x0n9di7Z dockerd[19142]: time="2022-08-21T23:23:06.767062772+08:00" level=info msg="stopping healthcheck following graceful shutdown" module=libcontainerd
Aug 21 23:23:06 iZbp1er6x0ndi7Z dockerd[19142]: time="2022-08-21T23:23:06.767163129+08:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled
Aug 21 23:23:06 iZbp1er6x0n0cei7Z systemd[1]: docker.service: Control process exited, code=exited status=203
Aug 21 23:23:07 iZbp1er6x6n0ce97Z systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 21 23:23:07 iZbp1er6x6n0cei7Z systemd[1]: Failed to start Docker Application Container Engine.

Hello-Linux avatar Aug 22 '22 02:08 Hello-Linux

sealer初始化会调用clean.sh,rm了

eto2099 avatar Aug 26 '22 07:08 eto2099

遇到了相同的问题,在阿里云服务器中,系统Ubuntu 18.0.4,希望安装一个单节点的k8s集群(希望在本服务器安装,因此先后试过服务器ip和本地ip 127.0.0.1)。

OS: ubuntu 18.04 linux kernel: 4.15.0-192-generic sealer version: {"gitVersion":"v0.8.6","gitCommit":"884513e","buildDate":"2022-07-12 02:58:54","goVersion":"go1.16.15","compiler":"gc","platform":"linux/amd64"}

运行sealer run -m 127.0.0.1 -p xxx之后出现以下提示:


++ dirname ./init-registry.sh
+ cd .
+ REGISTRY_PORT=5000
+ VOLUME=/var/lib/sealer/data/my-cluster/rootfs/registry
+ REGISTRY_DOMAIN=sea.hub
+ container=sealer-registry
+++ pwd
++ dirname /var/lib/sealer/data/my-cluster/rootfs/scripts
+ rootfs=/var/lib/sealer/data/my-cluster/rootfs
+ config=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_config.yml
+ htpasswd=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_htpasswd
+ certs_dir=/var/lib/sealer/data/my-cluster/rootfs/certs
+ image_dir=/var/lib/sealer/data/my-cluster/rootfs/images
+ mkdir -p /var/lib/sealer/data/my-cluster/rootfs/registry
+ load_images
+ for image in "$image_dir"/*
+ '[' -f /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar ']'
+ docker load -q -i /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
...
2022-09-13 16:04:20 [ERROR] [root.go:70] sealer-v0.8.6: failed to init master0: failed to execute command(cd /var/lib/sealer/data/my-cluster/rootfs/scripts && ./init-registry.sh 5000 /var/lib/sealer/data/my-cluster/rootfs/registry sea.hub) on host(127.0.0.1): error(Process exited with status 1)

以服务器公网ip作为master ip来安装时(卸载了自己安装的docker),出现以下提示:

++ dirname ./init-registry.sh
+ cd .
+ REGISTRY_PORT=5000
+ VOLUME=/var/lib/sealer/data/my-cluster/rootfs/registry
+ REGISTRY_DOMAIN=sea.hub
+ container=sealer-registry
+++ pwd
++ dirname /var/lib/sealer/data/my-cluster/rootfs/scripts
+ rootfs=/var/lib/sealer/data/my-cluster/rootfs
+ config=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_config.yml
+ htpasswd=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_htpasswd
+ certs_dir=/var/lib/sealer/data/my-cluster/rootfs/certs
+ image_dir=/var/lib/sealer/data/my-cluster/rootfs/images
+ mkdir -p /var/lib/sealer/data/my-cluster/rootfs/registry
+ load_images
+ for image in "$image_dir"/*
+ '[' -f /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar ']'
+ docker load -q -i /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
2022-09-13 17:05:00 [DEBUG] [sshcmd.go:114] failed to execute command(cd /var/lib/sealer/data/my-cluster/rootfs/scripts && ./init-registry.sh 5000 /var/lib/sealer/data/my-cluster/rootfs/registry sea.hub) on host(xxx): error(failed to execute command(cd /var/lib/sealer/data/my-cluster/rootfs/scripts && ./init-registry.sh 5000 /var/lib/sealer/data/my-cluster/rootfs/registry sea.hub) on host(xxx): error(Process exited with status 1))

查看docker状态,显示如下:

root@iZbp14czvx1exbfxgr520cZ:/var/run/docker# systemctl status docker
● docker.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead) since Tue 2022-09-13 15:56:09 CST; 1h 26min ago
 Main PID: 8991 (code=exited, status=0/SUCCESS)

Sep 13 15:52:40 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:52:40.178732070+08:00" level=info msg="Attempting next endpoint for pull after error: Get https://sea.hub:5000/v2/: net/http: req
Sep 13 15:52:40 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:52:40.178813138+08:00" level=error msg="Handler for POST /v1.40/images/create returned error: Get https://sea.hub:5000/v2/: net/h
Sep 13 15:52:55 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:52:55.209106031+08:00" level=warning msg="Error getting v2 registry: Get https://sea.hub:5000/v2/: net/http: request canceled whi
Sep 13 15:52:55 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:52:55.209148840+08:00" level=info msg="Attempting next endpoint for pull after error: Get https://sea.hub:5000/v2/: net/http: req
Sep 13 15:52:55 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:52:55.209185375+08:00" level=error msg="Handler for POST /v1.40/images/create returned error: Get https://sea.hub:5000/v2/: net/h
Sep 13 15:56:09 iZbp14czvx1exbfxgr520cZ systemd[1]: Stopping Docker Application Container Engine...
Sep 13 15:56:09 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:56:09.123579156+08:00" level=info msg="Processing signal 'terminated'"
Sep 13 15:56:09 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:56:09.464433975+08:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.Task
Sep 13 15:56:09 iZbp14czvx1exbfxgr520cZ dockerd[8991]: time="2022-09-13T15:56:09.507618852+08:00" level=info msg="Daemon shutdown complete"
Sep 13 15:56:09 iZbp14czvx1exbfxgr520cZ systemd[1]: Stopped Docker Application Container Engine.

尝试重启docker服务,也出现和楼上相似的报错systemd[5169]: docker.service: Failed at step EXEC spawning /usr/sbin/iptables: No such file or directory,完整状态如下:

Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ dockerd[4962]: time="2022-09-13T17:23:44.154681261+08:00" level=info msg="API listen on /var/run/docker.sock"
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ systemd[5169]: docker.service: Failed to execute command: No such file or directory
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ systemd[5169]: docker.service: Failed at step EXEC spawning /usr/sbin/iptables: No such file or directory
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ systemd[1]: docker.service: Control process exited, code=exited status=203
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ dockerd[4962]: time="2022-09-13T17:23:44.159999418+08:00" level=info msg="Processing signal 'terminated'"
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ dockerd[4962]: time="2022-09-13T17:23:44.424053918+08:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.Task
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ dockerd[4962]: time="2022-09-13T17:23:44.454106725+08:00" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd name
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ dockerd[4962]: time="2022-09-13T17:23:44.454531797+08:00" level=info msg="Daemon shutdown complete"
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 13 17:23:44 iZbp14czvx1exbfxgr520cZ systemd[1]: Failed to start Docker Application Container Engine.

cFireworks avatar Sep 13 '22 08:09 cFireworks

sealer不知道现在支不支持Ubuntu,执行以下重试即可: sed -i '/iptables/d' /lib/systemd/system/docker.service echo "ExecStartPost=/usr/sbin/iptables -P FORWARD ACCEPT" >> /lib/systemd/system/docker.service systemctl daemon-reload && systemctl restart docker

AutumnStack avatar Nov 28 '22 16:11 AutumnStack