Failed to start docker.service - Docker Application Container Engine

I’m trying to run the docker daemon.
But I’m facing the following error.
How to fix it?

failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables --wait -t nat -N DOCKER: iptables v1.8.7 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
pegasus@pegasus:/boot$ uname -a
Linux pegasus 6.4.7+ #2 SMP PREEMPT_DYNAMIC Sat Jul 29 00:27:16 +06 2023 x86_64 x86_64 x86_64 GNU/Linux
pegasus@pegasus:/boot$ sudo docker version
[sudo] password for pegasus: 
Client: Docker Engine - Community
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:52:14 2023
 OS/Arch:           linux/amd64
 Context:           default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
pegasus@pegasus:/boot$ sudo docker info
Client: Docker Engine - Community
 Version:    24.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.5
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
pegasus@pegasus:/boot$ snap list docker
error: no matching snaps installed
pegasus@pegasus:/boot$ dpkg -l | grep docker 
ii  docker-buildx-plugin                           0.10.5-1~ubuntu.23.04~lunar                amd64        Docker Buildx cli plugin.
ii  docker-ce                                      5:24.0.2-1~ubuntu.23.04~lunar              amd64        Docker: the open-source application container engine
ii  docker-ce-cli                                  5:24.0.2-1~ubuntu.23.04~lunar              amd64        Docker CLI: the open-source application container engine
ii  docker-ce-rootless-extras                      5:24.0.2-1~ubuntu.23.04~lunar              amd64        Rootless support for Docker.
ii  docker-compose-plugin                          2.18.1-1~ubuntu.23.04~lunar                amd64        Docker Compose (V2) plugin for the Docker CLI.

I had changed to iptables-legacy but didn’t solve the issue.

Please, share more information about your environment. Running the following commands and sharing the output could help:

docker version
docker info
snap list docker
dpkg -l | grep docker 

Assuming of course you are using Linux, so please, also share on what operating system you are using Docker.

I had added all the mentioned info.

Thank you for the details. So is it an Ubuntu based Linux distribution or just a simple Ubuntu 23.04?

Since that is supported, it should work, but I don’t have that version to test Docker on it. Did you follow this guide to install Docker?

Yes it’s ubuntu 23.04
But I had built and installed the latest linux stable kernel

Containers are very dependent on the kernel so that could cause the issue. Have you tried Docker on Ubuntu 23.04 with the default kernel?

I actually had a constant wifi issue. Realtek 8822ce driver issue. So current kernel is working really fine. It would be risky to change it to default one.

I understand that you needed a new kernel, but I have no idea if that kernel is supported by Docker. Since the documentation says the latest supported version is Ubuntu 23.04, if the kernel you are using is not available for Ubuntu 23.04 by default, it is not likely that the developers of Docker tested Docker with it. I would still help if I had an idea why you get the error message, but I don’t know. I have been using LTS Ubuntu versions for years. I think I used a non-LTS version in a situation in which you probably are. When I saw my hardware was not fully supported by the LTS version. and I hoped to get a better experience with a newer version. Unfortunately these upgrades also means that something else could break :frowning:

I could only search for the error message and find forums like this:

But I guess you have already done that and you restarted the operating system after upgrading the kernel. To be honest, I don’t even know how else we would see the version that we see.

I had found a fix.

downloaded:

  amd64/linux-headers-6.4.0-060400-generic_6.4.0-060400.202306271339_amd64.deb
  amd64/linux-headers-6.4.0-060400_6.4.0-060400.202306271339_all.deb
  amd64/linux-image-unsigned-6.4.0-060400-generic_6.4.0-060400.202306271339_amd64.deb
  amd64/linux-modules-6.4.0-060400-generic_6.4.0-060400.202306271339_amd64.deb

From https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.4/

Then manually installed all of the deb packages using
sudo dpkg -i <package_name>.deb

This solved the docker issue

1 Like