search
HomeOperation and MaintenanceDockerOffline installation of docker fails to start

Under the current wave of cloud computing and containerization, Docker has emerged as a mainstream application containerization technology and has become one of the most widely used tools in the field of operation, maintenance and development. In this context, Docker offline installation has also become a very common requirement. Because many users cannot connect to the Internet, or Internet connections are prohibited due to security and other factors, offline installation has become one of the most convenient installation methods. However, during the offline installation of Docker, the installation is often successful but the startup fails, which is a very troublesome problem for beginners.

This article will start from the actual operation, introduce the Docker offline installation method, and conduct a detailed analysis of the startup failure to provide you with a detailed guide.

1. Docker offline installation

There are two ways to install Docker offline: one is to install by downloading the Docker binary file, and the other is to install by configuring the yum source. The former is mainly suitable for servers without network conditions, while the latter is suitable for offline installation of Linux development environments.

1. Install by downloading the Docker binary file

The principle of this method is relatively simple, that is, download the Docker binary file to the local and then install it. The specific steps are as follows:

1.1 Obtain the Docker binary file

Download the corresponding version of the Docker binary file from the official website https://www.docker.com/. When downloading, you need to know the information about the current operating system. For centos system, you can choose to download the binary file corresponding to the following address.

https://download.docker.com/linux/static/stable/x86_64/ docker-version number.tgz

1.2 Install Docker binary file

When installing You need to unzip the downloaded binary file and move the docker and dockerd files to the /usr/bin directory.

tar -xvf docker-version number.tgz
cp docker/* /usr/bin

2. Install by configuring the yum source

Under the centos system , you can install Docker offline by configuring the yum source. The specific steps are as follows:

2.1 Obtain the yum source of Docker

Download the corresponding version of the Docker installation package from the official website https://www.docker.com/. When downloading, you need to know the information about the current operating system and download the rpm package corresponding to the system version.

2.2 Create a new local yum source

Create a local yum source directory, copy the downloaded Docker installation package to this directory, and create the directory through the createrepo command

mkdir /var/docker
cp docker-ce*.rpm /var/docker
createrepo /var/docker

2.3 Configure yum source

in /etc/yum Create a new repo file in the .repos.d directory and write the following content

[docker-local]
name=Docker Local repo
baseurl=file:///var/docker
enabled=1
gpgcheck=0

2.4 Install Docker

Execute the following command to install Docker

yum install docker-ce

二, Solution to startup failure

1. Problem description

After completing the above offline installation of Docker, you may encounter Docker startup failure and the following error occurs:

$ 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.

Executing the systemctl status docker.service command shows that the reason for the startup failure is that the "ExecStart" command in the docker.service file cannot be executed successfully:

$ sudo systemctl status docker.service
...
Apr 30 07:40:32 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Apr 30 07:40:32 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited , status=1/FAILURE
Apr 30 07:40:32 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Apr 30 07:40:32 localhost.localdomain systemd[1]: docker.service failed.
Apr 30 07:40:32 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
Apr 30 07:40:32 localhost.localdomain systemd[1] : Stopped Docker Application Container Engine.

$sudo journalctl -xe
dockerd-current[14552]: time="2020-04-30T07:40:32.652790118 08:00" level=error msg=" systemd notifier failed: Unable to load systemd module \"libsystemd.so\": cannot open shared o
dockerd-current[14552]: failed to start daemon: Error initializing network controller: list bridge addresses failed: PredefinedLocalScopeDefaultNetworks List failed: Predefined
dockerd-current[14552]: Error starting daemon: Error initializing network controller: list bridge addresses failed: PredefinedLocalScopeDefaultNetworks List failed: Predefined
systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Docker Application Container Engine.
systemd[1]: Unit docker.service entered failed state.
systemd[1]: docker.service failed.

2. Problem analysis

Through the above error message, you can find that the reason why Docker failed to start is because Docker's network controller cannot be started. Specifically, this is because Docker's network controller manages the container network through the iptables firewall, and the firewall prohibits all non-local traffic by default. For Docker, relevant rules will be automatically added to iptables when it is started for the first time. However, if Docker installed offline is started for the first time, the addition of rules will fail, causing the network controller to fail to start. The specific manifestation is that when the user starts Docker, Docker will automatically create a bridge named docker0 based on the local IP address. If this operation fails, Docker will not be able to start.

3. Problem solving

There are two main ways to solve this problem:

3.1 Create docker0 bridge

Manually creating docker0 bridge can solve the problem For this problem, under centos, you can execute the following command to manually create the docker0 bridge:

sudo ip link add name docker0 type bridge
sudo ip addr add dev docker0 172.17.0.1/16
sudo ip link set dev docker0 up

After completing the above operations, start Docker again and execute the following command as an administrator:

$ sudo systemctl start docker

to complete Docker of startup.

3.2 Modify the firewall rules

Turning off the firewall or modifying the firewall rules is also an effective way to solve this problem. When turning off the firewall, you can use the following command:

$ systemctl stop firewalld
$ systemctl disable firewalld

But this situation is not recommended. It is recommended to keep the system's firewall as much as possible according to security requirements. .

If you want to modify the iptables rules, you can add the rules through the following command:

$ sudo iptables -P FORWARD ACCEPT
$ sudo iptables -I FORWARD -j ACCEPT
$ sudo service iptables save

After performing the above operations, start Docker again and it will start normally.

3. Summary

Through the introduction of this article, we can see that when installing Docker offline, Docker may not start due to network problems. At this time, we need to understand the working principle of Docker's network controller and manually configure it or make certain modifications to the iptables firewall to finally solve the problem of Docker startup failure. Of course, we can also solve such problems by checking specific error messages in time and conducting analysis.

Therefore, during the offline installation and startup of Docker, we need to remain cautious and patient, continue to experiment and debug, and finally find a suitable method to solve the problem.

The above is the detailed content of Offline installation of docker fails to 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: 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".

How to view logs from dockerHow to view logs from dockerApr 15, 2025 pm 12:24 PM

The methods to view Docker logs include: using the docker logs command, for example: docker logs CONTAINER_NAME Use the docker exec command to run /bin/sh and view the log file, for example: docker exec -it CONTAINER_NAME /bin/sh ; cat /var/log/CONTAINER_NAME.log Use the docker-compose logs command of Docker Compose, for example: docker-compose -f docker-com

How to check the name of the docker containerHow to check the name of the docker containerApr 15, 2025 pm 12:21 PM

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to create containers for dockerHow to create containers for dockerApr 15, 2025 pm 12:18 PM

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

How to exit the container by dockerHow to exit the container by dockerApr 15, 2025 pm 12:15 PM

Four ways to exit Docker container: Use Ctrl D in the container terminal Enter exit command in the container terminal Use docker stop <container_name> Command Use docker kill <container_name> command in the host terminal (force exit)

How to copy files in docker to outsideHow to copy files in docker to outsideApr 15, 2025 pm 12:12 PM

Methods for copying files to external hosts in Docker: Use the docker cp command: Execute docker cp [Options] <Container Path> <Host Path>. Using data volumes: Create a directory on the host, and use the -v parameter to mount the directory into the container when creating the container to achieve bidirectional file synchronization.

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot 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

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.