postgresql - 在 docker-compose 中使用标记 postgres 图像?
问题描述
我有以下docker-compose
文件:
version: "3.7"
services:
bejebeje-identity:
build:
context: ./Bejebeje.Identity
labels:
com.bejebeje.description: "Bejebeje's Identity Server"
image: bejebeje/identity:latest
ports:
- "5006:443"
- "5005:80"
env_file:
- ./variables.env
depends_on:
- database
volumes:
- ~/.aspnet/https:/root/.aspnet/https/
database:
image: postgres:13.0
ports:
- "8001:5432"
volumes:
- data-volume:/var/lib/postgresql/data
env_file:
- ./variables.env
volumes:
data-volume:
当我运行docker-compose build .
构建图像时,然后运行docker image ls
并得到:
我怀疑<none>
图像是 postgres 数据库?在我的docker-compose
文件中,我怎样才能用类似的东西标记数据库图像database/bejebeje/identity
?
解决方案
“无”不是 postgres 图像,而是与 bejebeje-identit 相关,并且仅由 dockerfile 领导。
docker中有多阶段构建模式。它将创建多阶段泊坞窗图像。您可以从项目 dockerfile 中找到以下行。
# copy the contents of /app/out in the `build-env` and paste it in the
# `/app` directory of the new runtime container.
COPY --from=build-env /app/out .
这就是原因。只需重写您的 dockerfile,并删除前一个阶段的图像。然后您将不会再看到“非”标记的图像。
推荐阅读
- elasticsearch - helm chart stable/logstash - 在同一个 ns 中看不到 elasticsearch
- wordpress - 我的Wordpress网站速度很慢请告诉解决方案
- python - 为什么没有显示**额外信息?
- laravel - 如何使用刀片在@foreach 中随机播放文件
- angular - 拖放组件仅返回源代码
- validation - 如何在 yup 验证中访问数组内的父值
- python - DRF 中的 request.data 与 DRF 中的 serializers.data
- php - 如何在 PHP 后端使用 Webpack 的捆绑散列?
- java - Android中“NSScanner”类的等价类是什么?
- python - Python代码将行从一个文本文件复制到另一个,直到找到匹配的文本