我现在正在尝试在Kubernetes集群上运行一个带shell(/ bin/bash)的简单容器.
我认为有一种方法可以通过使用pseudo-tty和分离选项(命令-td选项docker run)来保持容器在Docker容器上运行.
例如,
$ sudo docker run -td ubuntu:latest
Run Code Online (Sandbox Code Playgroud)
在Kubernetes有这样的选择吗?
我尝试使用如下kubectl run-container命令运行容器:
kubectl run-container test_container ubuntu:latest --replicas=1
Run Code Online (Sandbox Code Playgroud)
但容器会退出几秒钟(就像使用docker run上面提到的没有选项的命令启动一样).并且ReplicationController重复再次启动它.
有没有办法让Kubernetes上的容器像命令中的-td选项一样运行docker run?
Postgresql服务无法在services.msc中启动.它在Window server 2008 R2中启动PostgreSQL服务时显示以下消息.
"本地计算机上的postgresql-x64-9.6服务已启动然后停止.如果某些服务未被其他服务或程序使用,则会自动停止."

我一直在尝试让 postgres 在 Docker(在 Windows 上)中运行并具有持久数据存储,并认为我终于拥有了它,但现在当我尝试启动容器时,出现以下错误:
LOG: invalid primary checkpoint record
LOG: invalid secondary checkpoint record
PANIC: could not locate a valid checkpoint record
Run Code Online (Sandbox Code Playgroud)
这是我启动并运行容器的开始:
docker volume create ct_data
docker run --name postgres_ct -v ct_data:/var/lib/postgresql/data -p 5432:5432 postgres
Run Code Online (Sandbox Code Playgroud)
然后,我使用 pgAdmin 连接到它,创建一个新表,并使用恢复选项导入 postgres 转储文件。数据加载没有问题。我使用与上面相同的卷启动了第二个容器,但使用不同的名称和端口号来测试它,并且我能够连接,因此我将其关闭。
Now, an hour later, I found my original container was stopped automatically so I tried to start it back up and got the errors above. This is my first attempt at using Docker, so it's very possible …
我使用以下命令每天备份 postgresql 数据库
/usr/bin/pg_basebackup -D $outdir -Ft -x -z -w -R -v
Run Code Online (Sandbox Code Playgroud)
现在我想在另一台服务器上恢复这个数据库。我使用了https://www.postgresql.org/docs/9.5/static/continuous-archiving.html#BACKUP-PITR-RECOVERY上的描述。
recovery.conf备份中包含的文件具有以下内容:
standby_mode = 'on'
primary_conninfo = 'user=postgres port=5432 sslmode=prefer sslcompression=1 krbsrvname=postgres'
Run Code Online (Sandbox Code Playgroud)
文档中的下一步 (8.) 说要启动 postgresql。这会由于超时而导致失败:
3783 postgres: startup process waiting for 0000000100000024000000B
Run Code Online (Sandbox Code Playgroud)
在原始服务器上我没有这个文件。是否可以在不使用任何 WAL 文件的情况下仅恢复 pg_basebackup 的状态?那么 recovery.conf 文件中应该有什么?
按照@JosMac 的建议,我用这个结果移动了 recovery.conf:
shaun2:/var/lib/pgsql/data # service postgresql start
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.
shaun2:/var/lib/pgsql/data # service postgresql status
â …Run Code Online (Sandbox Code Playgroud)