小编Jac*_*ack的帖子

在Dockerfile中启动postgres

当我使用postgres docker镜像时,我运行

docker run --name mydb -e POSTGRES_PASSWORD=password -d postgres
Run Code Online (Sandbox Code Playgroud)

我看到一个容器在运行。

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                       NAMES
a36b98h8982a        postgres            "docker-entrypoint.s…"   36 minutes ago      Up 36 minutes       5432/tcp                    mydb
Run Code Online (Sandbox Code Playgroud)

所以我制作了Dockerfile,因为我想初始化数据库

FROM postgres:latest

COPY pg-setup.sql /docker-entrypoint-initdb.d/

CMD ['postgres']
Run Code Online (Sandbox Code Playgroud)

但是,当我使用Dockerfile时,容器会立即退出。我如何使其像postgres图像一样运行?

postgresql docker

4
推荐指数
1
解决办法
858
查看次数

如何在Python中并排打印两个字符串(大文本)?

我如何在 Python 中编写代码来执行此操作?我想读取两个多行多文本的字符串,主要是为了比较它们的相似程度(定性)。

    s1 = 'I want to read these texts side by side and see how similar they really are'
    s2 = 'I really want to read these here texts side by side to see how similar they are (qualitatively)'
    print_side_by_side(s1,s2)
Run Code Online (Sandbox Code Playgroud)

输出:

    I want to read these texts side by side and see ho   I really want to read these here texts side by sid
    w similar they really are                            e to see how similar they are (qualitatively)     
Run Code Online (Sandbox Code Playgroud)

python printing string

3
推荐指数
1
解决办法
5616
查看次数

标签 统计

docker ×1

postgresql ×1

printing ×1

python ×1

string ×1