运行或重新启动PostgreSQL映像后,Docker容器立即退出 [英] Docker container exits immediately after running or restarting PostgreSQL image

查看:680
本文介绍了运行或重新启动PostgreSQL映像后,Docker容器立即退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是docker的初学者,由于容器重启问题,我被卡在了位。
当我尝试重新启动现有的退出容器或创建新容器(删除旧容器后)运行时,会发生问题:

I am begginer with docker, and I stuck in place due to container restarting problem. The problem occures when I try to restart an existing exited container, or create new container (after deleting old one) running:

docker run -d --name mempostgres \
    -v "/home/lukasz/lc_pg_data:/var/lib/pgsql/data:Z" \
    -e POSTGRES_USER=postgres \
    -e POSTGRES_PASSWORD=password \
    -e POSTGRES_DB=dbName \
    -p 5432:5432 \
    fedora/postgresql

我的容器总是立即退出,状态为 Exited(1)

My container always exits immediately with status "Exited(1)"

我的容器日志有:

Inside the logs of my container i have:

但是我没有正在运行的PostgreSQL服务器

However I don't have any PostgreSQL server running at this moment.

推荐答案

您需要终止该 postmaster 进程。

cat ... / postmaster.pid

此文件的第一个数字是 postmaster 进程的PID。

The first number of this file is the PID of postmaster process.

然后,使用以下命令终止该进程:

Then, kill that process using:

杀死PID

最后,运行一个容器,您的问题应该得到解决。

Finally, run a container, your problem should be fixed.

这篇关于运行或重新启动PostgreSQL映像后,Docker容器立即退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆