[英]How to fix a restarting Docker container?
Here are my running Dockers:这是我正在运行的 Docker:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
********* easyengine/cron:v4.0.0 "/usr/bin/ofelia dae…" 2 weeks ago Up 10 minutes ee-cron-scheduler
********* easyengine/nginx:v4.1.4 "/usr/bin/openresty …" 2 weeks ago Up 10 minutes 80/tcp 9to6livein_nginx_1
********* easyengine/postfix:v4.1.5 "postfix start-fg" 2 weeks ago Up 10 minutes 25/tcp 9to6livein_postfix_1
********* easyengine/php:v4.1.6 "docker-entrypoint.s…" 2 weeks ago Up 10 minutes 9000/tcp 9to6livein_php_1
********* easyengine/mariadb:v4.1.3 "docker-entrypoint.s…" 2 weeks ago Restarting (1) 37 seconds ago services_global-db_1
********* easyengine/nginx-proxy:v4.1.4 "/app/docker-entrypo…" 2 weeks ago Up 6 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp services_global-nginx-proxy_1
As you can see the mariadb container (services_global-db_1) is continuously restarting.如您所见,mariadb 容器 (services_global-db_1) 不断重启。 How do I fix this?我该如何解决?
Here's the log file of docker logs services_global-db_1:这是docker 日志 services_global-db_1 的日志文件:
2021-04-16 11:09:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2021-04-16 11:09:29+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-04-16 11:09:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2021-04-16 11:09:29 0 [Note] mysqld (mysqld 10.5.4-MariaDB-1:10.5.4+maria~focal) starting as process 1 ...
2021-04-16 11:09:29 0 [Warning] You need to use --log-bin to make --binlog-format work.
2021-04-16 11:09:29 0 [Note] InnoDB: Using Linux native AIO
2021-04-16 11:09:29 0 [Note] InnoDB: Uses event mutexes
2021-04-16 11:09:29 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-04-16 11:09:29 0 [Note] InnoDB: Number of pools: 1
2021-04-16 11:09:29 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2021-04-16 11:09:29 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2021-04-16 11:09:30 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2021-04-16 11:09:30 0 [Note] InnoDB: Completed initialization of buffer pool
2021-04-16 11:09:30 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955232 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955166 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955167 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955173 was in the XA prepared state.
2021-04-16 11:09:30 0 [Note] InnoDB: 4 transaction(s) which must be rolled back or cleaned up in total 0 row operations to undo
2021-04-16 11:09:30 0 [Note] InnoDB: Trx id counter is 955233
2021-04-16 11:09:30 0 [Note] InnoDB: 128 rollback segments are active.
2021-04-16 11:09:30 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-04-16 11:09:30 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-04-16 11:09:30 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-04-16 11:09:30 0 [Note] InnoDB: 10.5.4 started; log sequence number 3046186820; transaction id 955235
2021-04-16 11:09:30 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-04-16 11:09:30 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-04-16 11:09:30 0 [Note] InnoDB: Buffer pool(s) load completed at 210416 11:09:30
2021-04-16 11:09:30 0 [Note] InnoDB: Starting in background the rollback of recovered transactions
2021-04-16 11:09:30 0 [Note] InnoDB: Starting recovery for XA transactions...
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955167 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955232 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955173 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction 955166 in prepared state after recovery
2021-04-16 11:09:30 0 [Note] InnoDB: Transaction contains changes to 1 rows
2021-04-16 11:09:30 0 [Note] InnoDB: 4 transactions in prepared state after recovery
2021-04-16 11:09:30 0 [Note] Found 4 prepared transaction(s) in InnoDB
2021-04-16 11:09:30 0 [ERROR] Found 4 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions.
2021-04-16 11:09:30 0 [ERROR] Aborting
There is an error on second last line.倒数第二行有错误。
But, when I attempt to open a bash session (docker exec -it services_global-db_1 bash) with the container so I could run the SQL command (mysqld_safe --tc-heuristic-recover=COMMIT) I get the message that the Container... is restarting, wait until the container is running. But, when I attempt to open a bash session (docker exec -it services_global-db_1 bash) with the container so I could run the SQL command (mysqld_safe --tc-heuristic-recover=COMMIT) I get the message that the Container. .. 正在重新启动,等待容器运行。
Now, I banged my head against all the walls, but couldn't find a solution.现在,我把头撞到了所有的墙上,但找不到解决办法。 How do I fix this?我该如何解决? How to stop the container from restarting?如何阻止容器重新启动?
Delete the container using the below command and try to spin up the container again.使用以下命令删除容器并尝试再次启动容器。
docker container rm CONTAINER_ID
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.