国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Operation and Maintenance Docker What should I do if docker start cannot start?

What should I do if docker start cannot start?

Oct 21, 2022 pm 03:43 PM
docker start

docker start起不來的解決辦法:1、檢查運(yùn)行狀態(tài),然后通過“echo 3 > /proc/sys/vm/drop_caches”命令釋放被占用的內(nèi)存;2、通過“$netstat -nltp|grep ...”命令檢查端口是否已經(jīng)被占用,如果上線后發(fā)現(xiàn)占有,則改為可用端口再重啟即可。

What should I do if docker start cannot start?

本教程操作環(huán)境:linux7.3系統(tǒng)、docker19.03版、Dell G3電腦。

docker start起不來怎么辦?

Docker無法正常啟動的原因及解決辦法

概述

Docker啟動異常表現(xiàn)

狀態(tài)反復(fù)restaring,用命令查看

$docker ps -a
CONTAINER ID    IMAGE  COMMAND       CREATED      STATUS       PORTS    NAMES
21c09be88c11     docker.xxxx.cn:5000/xxx-tes/xxx_tes:1.0.6   "/usr/local/tomcat..."   9 days ago          Restarting (1) Less than a second ago                      xxx10

Docker日志有明顯問題:

$docker logs [容器名/容器ID]
比如:
docker logs openresty

Docker啟動異常的可能原因

內(nèi)存不夠

Docker 啟動至少需要2G內(nèi)存,首先執(zhí)行free -mh命令查看剩余內(nèi)存是否足夠

直接查看內(nèi)存

$free -mh
            total        used        free      shared  buff/cache   available
Mem:         15G         14G          627M        195M        636M     726M
Swap:         0B          0B          0B

分析日志

有時(shí)候一瞬間內(nèi)存過載溢出,導(dǎo)致部分進(jìn)程被殺死,看起來內(nèi)存也是夠用的,事實(shí)上docker還是會反復(fù)重啟,就需要通過docker日志和系統(tǒng)日志信的息來進(jìn)一步分析:

分析docker日志

查看docker日志看到內(nèi)存溢出的信息,要仔細(xì)翻閱才能找到信息,并不是在最下面

$docker logs [容器名/容器ID]|less 
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000769990000, 1449590784, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1449590784 bytes for committing reserved memory.
# An error report file with more information is saved as:
# //hs_err_pid1.log
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000769990000, 1449590784, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1449590784 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmp/hs_err_pid1.log
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000769990000, 1449590784, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1449590784 bytes for committing reserved memory.
# Can not save log file, dump to screen..
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1449590784 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2756), pid=1, tid=140325689620224
#
# JRE version:  (7.0_79-b15) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.79-b02 mixed mode linux-amd64 compressed oops)
# Core dump written. Default location: //core or core.1
#

分析系統(tǒng)日志

查看系統(tǒng)日志,發(fā)現(xiàn)有大量由于內(nèi)存溢出,進(jìn)程被殺死的記錄

$grep -i 'Out of Memory' /var/log/messages
Apr  7 10:04:02 centos106 kernel: Out of memory: Kill process 1192 (java) score 54 or sacrifice child
Apr  7 10:08:00 centos106 kernel: Out of memory: Kill process 2301 (java) score 54 or sacrifice child
Apr  7 10:09:59 centos106 kernel: Out of memory: Kill process 28145 (java) score 52 or sacrifice child
Apr  7 10:20:40 centos106 kernel: Out of memory: Kill process 2976 (java) score 54 or sacrifice child
Apr  7 10:21:08 centos106 kernel: Out of memory: Kill process 3577 (java) score 47 or sacrifice child
Apr  7 10:21:08 centos106 kernel: Out of memory: Kill process 3631 (java) score 47 or sacrifice child
Apr  7 10:21:08 centos106 kernel: Out of memory: Kill process 3634 (java) score 47 or sacrifice child
Apr  7 10:21:08 centos106 kernel: Out of memory: Kill process 3640 (java) score 47 or sacrifice child
Apr  7 10:21:08 centos106 kernel: Out of memory: Kill process 3654 (java) score 47 or sacrifice child
Apr  7 10:27:27 centos106 kernel: Out of memory: Kill process 6998 (java) score 51 or sacrifice child
Apr  7 10:27:28 centos106 kernel: Out of memory: Kill process 7027 (java) score 52 or sacrifice child
Apr  7 10:28:10 centos106 kernel: Out of memory: Kill process 7571 (java) score 42 or sacrifice child
Apr  7 10:28:10 centos106 kernel: Out of memory: Kill process 7586 (java) score 42 or sacrifice child

端口沖突

該docker監(jiān)聽端口已經(jīng)被其他進(jìn)程占用,一般此種問題容易出現(xiàn)在新部署的服務(wù),或在原有機(jī)器上部署新的后臺服務(wù),所以在部署之前應(yīng)該執(zhí)行命令檢查端口是否已經(jīng)被占用,如果上線后發(fā)現(xiàn)占有則應(yīng)改為可用端口再重啟之。

檢查命令:    netstat -nltp|grep [規(guī)劃的端口號]

解決方案

內(nèi)存不夠的方案

進(jìn)程在運(yùn)行一段時(shí)間后占用大量內(nèi)存,需要將其重啟。重啟命令可能有時(shí)并不起作用。主要檢查運(yùn)行狀態(tài),如果未成功停止,則重新重啟;

ELK日志收集程序或者其他java進(jìn)程占用過高,用top和ps命令排查,謹(jǐn)慎確定進(jìn)程的作用,在確保不影響業(yè)務(wù)的情況下,停止相關(guān)進(jìn)程;

釋放被占用的內(nèi)存(buff/cache)

 [root]# sync  #將內(nèi)存數(shù)據(jù)寫入磁盤
 [root]# echo 3 > /proc/sys/vm/drop_caches  #釋放被占用的內(nèi)存

有時(shí)候并不是buff/cache過高導(dǎo)致內(nèi)存不夠用,確實(shí)是被很多必要的進(jìn)程消耗掉了內(nèi)存,那就需要從機(jī)器資源分配使用的層面去考慮和解決了。

端口沖突的對策

一般此種問題容易出現(xiàn)在新部署的服務(wù),或在原有機(jī)器上部署新的后臺服務(wù),所以在部署之前應(yīng)該執(zhí)行命令檢查端口是否已經(jīng)被占用,如果上線后發(fā)現(xiàn)占有則應(yīng)改為可用端口再重啟之。

檢查命令:    $netstat -nltp|grep [規(guī)劃的端口號]

推薦學(xué)習(xí):《docker視頻教程

The above is the detailed content of What should I do if docker start cannot start?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

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.

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to exit the container by docker How to exit the container by docker Apr 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 start containers by docker How to start containers by docker Apr 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 check the name of the docker container How to check the name of the docker container Apr 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 copy files in docker to outside How to copy files in docker to outside Apr 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.

How to create containers for docker How to create containers for docker Apr 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 start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

How to view logs from docker How to view logs from docker Apr 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

.NET Core Quick Start Tutorial 1. The beginning: Talking about .NET Core .NET Core Quick Start Tutorial 1. The beginning: Talking about .NET Core May 07, 2025 pm 04:54 PM

1. The Origin of .NETCore When talking about .NETCore, we must not mention its predecessor .NET. Java was in the limelight at that time, and Microsoft also favored Java. The Java virtual machine on the Windows platform was developed by Microsoft based on JVM standards. It is said to be the best performance Java virtual machine at that time. However, Microsoft has its own little abacus, trying to bundle Java with the Windows platform and add some Windows-specific features. Sun's dissatisfaction with this led to a breakdown of the relationship between the two parties, and Microsoft then launched .NET. .NET has borrowed many features of Java since its inception and gradually surpassed Java in language features and form development. Java in version 1.6

See all articles