Home  >  Article  >  Operation and Maintenance  >  How to check whether the docker service is enabled

How to check whether the docker service is enabled

PHPz
PHPzOriginal
2023-04-10 14:17:294299browse

When using Docker to develop and deploy applications, we need to first ensure that the Docker service is turned on. This article will introduce you how to check whether the Docker service is started.

The first step is to check whether the Docker service is started

We can check whether the Docker service has been started by entering the following command in the terminal:

systemctl status docker

If the service is already started, You will see the following output:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-11-03 11:00:00 CST; 2h ago
     Docs: https://docs.docker.com
 Main PID: 12345 (dockerd)
    Tasks: 10
   Memory: 167.6M
   CGroup: /system.slice/docker.service
           ├─12345 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
           └─12346 containerd --config /var/run/containerd/containerd.toml --log-level info

If the service is not started, you will see the following output:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: https://docs.docker.com

If the status is inactive (dead), please follow The following steps start the service.

Second step, start the Docker service

If the Docker service does not start, you can start the service through the following command:

systemctl start docker

In addition, you can also use the following command to determine Whether the Docker service is started and its status is monitored after startup:

systemctl is-active docker
systemctl is-enabled docker
systemctl is-failed docker
  • is-active The command will return active indicating that the service is running;
  • The
  • is-enabled command will return enabled indicating that the service will automatically start when the system starts; the
  • is-failed command will return failed indicates that the service failed to start.

Summary

In this article, we introduced how to check whether the Docker service is started. Docker is a commonly used containerization technology that helps us develop and deploy applications more easily. Before using Docker, we need to ensure that the Docker service has been started. Only in this way can we ensure that we can use Docker normally. I hope this article can help you better understand how to use the Docker service.

The above is the detailed content of How to check whether the docker service is enabled. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn