search
HomeOperation and MaintenanceDockerHow to solve the problem that docker-machine cannot start

Solution to the problem that docker-machine cannot be started: 1. Use "docker-machine ls" to check the host status; 2. Uninstall the existing docker and reinstall it; 3. Start docker and check the docker service status. Can.

How to solve the problem that docker-machine cannot start

The operating environment of this article: centos7 system, Docker version 19.03.9, Dell G3 computer.

How to solve the problem that docker-machine cannot start?

Centos7 docker-machine deploys docker host and the docker service fails to start

Background:

Plans to use Centos7 Core as docker host to build tests The platform has only 4 hosts and uses the Swarm solution.

Environment:

Host Name System IP Address Pre-work
docker-host1 CentOS7 Core xxx.xxx.xxx.80

Update the yum source, use aliyun mirror, update to the latest status

Configure the user used by docker-machine, sudo password-free

docker-host2 CentOS7 Core xxx.xxx.xxx.81

Update yum source, use aliyun image, update to the latest status

Configure docker-machine to use User, sudo password-free

docker-host3 CentOS7 Core xxx.xxx.xxx.82

Update yum source, use aliyun mirror, update to the latest status

Configure the user used by docker-machine, sudo password-free

docker- host4 CentOS7 Core xxx.xxx.xxx.83

Update yum source, use aliyun mirror, update to the latest status

Configuration The user used by docker-machine, sudo password-free

desktop ubuntu-18.04lts Configuration-free Log in to docker-host with the secret key

Installation:

Install docker-machine on the working desktop (Ubuntu) host, you can Refer to https://docs.docker.com/machine/install-machine/

First install docker-host1:

docker-machine --debug create --driver generic - -generic-ip-address=xxx.xxx.xxx.80 --generic-ssh-key=/home/sleeber/.ssh/id_rsa --generic-ssh-port=22 --generic-ssh-user=wntime docker -host1

The final output of the installation shows that the docker service cannot be started:

sudo systemctl -f start docker
SSH cmd err, output: exit status 1: Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

Error creating machine: Error running provisioning: something went wrong running an SSH command
command : sudo systemctl -f start docker
err     : exit status 1
output  : Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

notifying bugsnag: [Error creating machine: Error running provisioning: something went wrong running an SSH command
command : sudo systemctl -f start docker
err     : exit status 1
output  : Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
]

Use docker-machine ls to view the host status:

:~/docker-test-env$ docker-machine ls
NAME         ACTIVE   DRIVER    STATE     URL                      SWARM   DOCKER    ERRORS
docker-host1   -        generic   Running   tcp://xxx.xxx.xxx.80:2376           Unknown   Unable to query docker version: Cannot connect to the docker engine endpoint

SSH to the docker-host1 host , manually start the docker service

sudo systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

Follow the prompts to check the status

 systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─10-machine.conf
   Active: failed (Result: start-limit) since Thu 2020-05-28 20:41:39 EDT; 581ms ago
     Docs: https://docs.docker.com
  Process: 30463 ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver overlay2 --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic (code=exited, status=1/FAILURE)
 Main PID: 30463 (code=exited, status=1/FAILURE)
谷歌一下:
https://github.com/moby/moby/issues/33931
https://www.jianshu.com/p/bd395fdf7611
https://www.jianshu.com/p/93518610eea1

According to the search results, it should be caused by 10-machine.conf; but the 10-machine.conf file and folder were deleted Still unable to start

$ sudo rm /etc/systemd/system/docker.service.d/10-machine.conf
$ sudo systemctl start docker
Failed to start docker.service: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status docker.service' for details.
$ sudo rm -rf /etc/systemd/system/docker.service.d/
$ sudo systemctl start docker
Failed to start docker.service: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status docker.service' for details.

Using dockerd can start directly

$ sudo nohup dockerd &
[1] 31419
$ nohup: ignoring input and appending output to ‘nohup.out’

$ ll
total 4
-rw-------. 1 root root 2638 May 28 20:52 nohup.out
$ tail -f nohup.out
tail: cannot open ‘nohup.out’ for reading: Permission denied
tail: no files remaining
$ sudo tail -f nohup.out
time="2020-05-28T20:52:56.409646032-04:00" level=warning msg="Base device already exists and has filesystem xfs on it. User specified filesystem  will be ignored." storage-driver=devicemapper
time="2020-05-28T20:52:56.430282474-04:00" level=info msg="[graphdriver] using prior storage driver: devicemapper"
time="2020-05-28T20:52:56.430326847-04:00" level=warning msg="[graphdriver] WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release"
time="2020-05-28T20:52:56.433336530-04:00" level=warning msg="mountpoint for pids not found"
time="2020-05-28T20:52:56.433595847-04:00" level=info msg="Loading containers: start."
time="2020-05-28T20:52:56.529329426-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
time="2020-05-28T20:52:56.558933143-04:00" level=info msg="Loading containers: done."
time="2020-05-28T20:52:56.570819898-04:00" level=info msg="Docker daemon" commit=9d988398e7 graphdriver(s)=devicemapper version=19.03.9
time="2020-05-28T20:52:56.570873940-04:00" level=info msg="Daemon has completed initialization"
time="2020-05-28T20:52:56.585131361-04:00" level=info msg="API listen on /var/run/docker.sock"
^C
$ sudo docker version
Client: Docker Engine - Community
 Version:           19.03.9
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        9d988398e7
 Built:             Fri May 15 00:25:27 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.9
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       9d988398e7
  Built:            Fri May 15 00:24:05 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Using systemctl to check the docker service status still shows failure

$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─10-machine.conf
   Active: failed (Result: start-limit) since Thu 2020-05-28 20:49:52 EDT; 4min 59s ago
     Docs: https://docs.docker.com
  Process: 31051 ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver overlay2 --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic (code=exited, status=1/FAILURE)
 Main PID: 31051 (code=exited, status=1/FAILURE)

May 28 20:49:50 test-java2 systemd[1]: docker.service failed.
May 28 20:49:52 test-java2 systemd[1]: docker.service holdoff time over, scheduling restart.
May 28 20:49:52 test-java2 systemd[1]: Stopped Docker Application Container Engine.
May 28 20:49:52 test-java2 systemd[1]: start request repeated too quickly for docker.service
May 28 20:49:52 test-java2 systemd[1]: Failed to start Docker Application Container Engine.
May 28 20:49:52 test-java2 systemd[1]: Unit docker.service entered failed state.
May 28 20:49:52 test-java2 systemd[1]: docker.service failed.
May 28 20:50:45 test-java2 systemd[1]: start request repeated too quickly for docker.service
May 28 20:50:45 test-java2 systemd[1]: Failed to start Docker Application Container Engine.
May 28 20:50:45 test-java2 systemd[1]: docker.service failed.

Inferring that docker-machine still has some problems installing docker, we can only Manual installation

Note: After uninstalling docker, you need to manually delete the /etc/systemd/system/docker.service.d/ folder, otherwise the newly installed docker will not start.

Uninstall the existing docker and reinstall it

sudo yum remove docker* \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

sudo rm -rf /etc/systemd/system/docker.service.d/

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

sudo yum install -y docker-ce docker-ce-cli containerd.io

Start docker and check the docker service status

$ sudo docker version
Client: Docker Engine - Community
 Version:           19.03.10
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        9424aeaee9
 Built:             Thu May 28 22:18:06 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.10
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       9424aeaee9
  Built:            Thu May 28 22:16:43 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

It can be started normally

Recommended Study: "docker video tutorial"

The above is the detailed content of How to solve the problem that docker-machine cannot start. 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
Docker on Linux: Containerization for Linux SystemsDocker on Linux: Containerization for Linux SystemsApr 22, 2025 am 12:03 AM

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

Docker: The Containerization Tool, Kubernetes: The OrchestratorDocker: The Containerization Tool, Kubernetes: The OrchestratorApr 21, 2025 am 12:01 AM

Docker is a containerization tool, and Kubernetes is a container orchestration tool. 1. Docker packages applications and their dependencies into containers that can run in any Docker-enabled environment. 2. Kubernetes manages these containers, implementing automated deployment, scaling and management, and making applications run efficiently.

Docker's Purpose: Simplifying Application DeploymentDocker's Purpose: Simplifying Application DeploymentApr 20, 2025 am 12:09 AM

The purpose of Docker is to simplify application deployment and ensure that applications run consistently in different environments through containerization technology. 1) Docker solves the environmental differences problem by packaging applications and dependencies into containers. 2) Create images using Dockerfile to ensure that the application runs consistently anywhere. 3) Docker's working principle is based on images and containers, and uses the namespace and control groups of the Linux kernel to achieve isolation and resource management. 4) The basic usage includes pulling and running images from DockerHub, and the advanced usage involves managing multi-container applications using DockerCompose. 5) Common errors such as image building failure and container failure to start, you can debug through logs and network configuration. 6) Performance optimization construction

Linux and Docker: Docker on Different Linux DistributionsLinux and Docker: Docker on Different Linux DistributionsApr 19, 2025 am 12:10 AM

The methods of installing and using Docker on Ubuntu, CentOS, and Debian are different. 1) Ubuntu: Use the apt package manager, the command is sudoapt-getupdate&&sudoapt-getinstalldocker.io. 2) CentOS: Use the yum package manager and you need to add the Docker repository. The command is sudoyumininstall-yyum-utils&&sudoyum-config-manager--add-repohttps://download.docker.com/lin

Mastering Docker: A Guide for Linux UsersMastering Docker: A Guide for Linux UsersApr 18, 2025 am 12:08 AM

Using Docker on Linux can improve development efficiency and simplify application deployment. 1) Pull Ubuntu image: dockerpullubuntu. 2) Run Ubuntu container: dockerrun-itubuntu/bin/bash. 3) Create Dockerfile containing nginx: FROMubuntu;RUNapt-getupdate&&apt-getinstall-ynginx;EXPOSE80. 4) Build the image: dockerbuild-tmy-nginx. 5) Run container: dockerrun-d-p8080:80

Docker on Linux: Applications and Use CasesDocker on Linux: Applications and Use CasesApr 17, 2025 am 12:10 AM

Docker simplifies application deployment and management on Linux. 1) Docker is a containerized platform that packages applications and their dependencies into lightweight and portable containers. 2) On Linux, Docker uses cgroups and namespaces to implement container isolation and resource management. 3) Basic usages include pulling images and running containers. Advanced usages such as DockerCompose can define multi-container applications. 4) Debug commonly used dockerlogs and dockerexec commands. 5) Performance optimization can reduce the image size through multi-stage construction, and keeping the Dockerfile simple is the best practice.

Docker: Containerizing Applications for Portability and ScalabilityDocker: Containerizing Applications for Portability and ScalabilityApr 16, 2025 am 12:09 AM

Docker is a Linux container technology-based tool used to package, distribute and run applications to improve application portability and scalability. 1) Dockerbuild and dockerrun commands can be used to build and run Docker containers. 2) DockerCompose is used to define and run multi-container Docker applications to simplify microservice management. 3) Using multi-stage construction can optimize the image size and improve the application startup speed. 4) Viewing container logs is an effective way to debug container problems.

How to start containers by dockerHow to start containers by dockerApr 15, 2025 pm 12:27 PM

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools