Docker-使用从第一个条目生成的基本图像在yaml中组成第二个条目

时间:2017-01-16 10:36:58

标签: docker docker-compose

我需要用docker做下一个:

像docker-compose.yaml一样

version: '2'

services:

  builder:
      image: "whatever-docker-image"
      command: "docker build -t builder ."

  local:
    image: "builder:latest" <----Image generated in prevoious command 
    depends_on: [builder]

我该怎么做?

1 个答案:

答案 0 :(得分:0)

您应该使用build combainde与image命令代替command see this

version: '2'

services:

  builder:
      build: .
      image: builder

  local:
    image: "builder:latest" <----Image generated in prevoious command