大网数据广告活动
服务器运维问答

Docker <none>:<none> images

· 52CE 我爱测

I'm new to docker and I'm using a compose file to build from a Dockerfile and run and image for me I have the following yml file version: '2' services: multichain: build: ./ image: ubuntu:15.04 read_only: false volumes: - .:/data…

问题原文

原帖链接 · Kendall · CC BY-SA 3.0

I'm new to docker and I'm using a compose file to build from a Dockerfile and run and image for me I have the following yml file

version: '2'

services:
  multichain:
    build: ./
    image: ubuntu:15.04
    read_only: false
    volumes:
      - .:/data:rw
    working_dir: /data
    #entrypoint: node server/index.js

docker-compose up --build produces

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              5c5580fb6ce4        2 minutes ago       175.1 MB
ubuntu              15.04               d1b55fd07600        10 months ago       131.3 MB

Which is expected but can I replace the "" with something during the build in docker-compose?

Also when I run the file again it will create another : can't I just replace whats already there?

已采纳解答

原帖链接 · Jason Martin · CC BY-SA 3.0

Docker doesn't replace images, you have to run another command to delete the old ones. According to https://docs.docker.com/compose/compose-file/#/build, by adding 'image' after 'build' you are instructing docker to label your new build as ubuntu:15.04.

You don't want to specify the base image in the compose file, the Dockerfile FROM does that.

I think you want to change ubuntu:15.04 in your example to something like myapp:latest

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。