"Docker: unrecognized service" error - How to fix ?








Docker is an open-source containerization platform to run on Windows, Linux, and macOS.

Are you trying to resolve "Docker: unrecognized service" error ? We can help you.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Docker queries.

In this context, we shall look into steps to resolve this docker error.


Nature of  "Docker: unrecognized service" error

After installing Docker on Centos, users may see this error while trying to start the Docker service:

# service docker start
docker: unrecognized service

In this guide, you will see different ways to tackle this issue.


Ways to fix "Docker: unrecognized service" error ?

1. Remove docker and then edit Repo

First, remove the docker using below command:

$ yum remove docker

Then remove docker-selinux (if you have installed it before):

$ yum remove docker-selinux

Then modify the file:

$ vi /etc/yum.repos.d/docker.repo

Fill in the following content directly:

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

Then start the installation:

$ yum install docker-engine
Installed as a dependency: docker-engine-selinux.noarch 0:1.10.2-1.el7.centos

Finally, start the docker service:

$ service docker start

The following status code is returned:

Starting cgconfig service: [OK]
Starting docker: [OK]

This ensures that the docker starts successfully.


2. Re-install docker

Here, you can directly install using below command:

# curl -fsSL https://get.docker.com/ | sh + sh -c’sleep 3; yum -y -q install docker-engine’

You might see the below prompt message which can be ignored:

Warning: /var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm: header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm public key has not been installed Import GPG key 0x2C52609D: User ID: “Docker Release Tool (releasedocker) “Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d From: https://yum.dockerproject.org/gpg setsebool: SELinux is disabled. + sh -c’docker version’ Client: Version: 1.10.2 API version: 1.22 Go version: go1.5.3 Git commit: c3959b1 Built: Mon Feb 22 16:16:33 2016 OS/Arch: linux/amd64 Cannot connect to the Docker daemon. Is the docker daemon running on this host? If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like: sudo usermod -aG docker your-user Remember that you will have to log out and back in for this to take effect!

Then just start it directly using the below command:

$ service docker start Redirecting to /bin/systemctl start docker.service


[Need help with fixing Docker error ? We can help you. ]



Conclusion

This article covers ways to fix "Docker: unrecognized service" error which may occur while trying to restart Docker service. in fact, it can happens when WSL cannot connect to the docker daemon running through Docker for Windows, probably because it is not exposed or is not running.


For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com