当我使用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图像一样运行?
我如何在 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)