mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
Merge pull request #3024 from aanand/update-build-image-docs
Update docs about using build and image together
This commit is contained in:
commit
f5ce31d43e
@ -59,6 +59,14 @@ optionally [dockerfile](#dockerfile) and [args](#args).
|
|||||||
args:
|
args:
|
||||||
buildno: 1
|
buildno: 1
|
||||||
|
|
||||||
|
If you specify `image` as well as `build`, then Compose tags the built image
|
||||||
|
with the tag specified in `image`:
|
||||||
|
|
||||||
|
build: ./dir
|
||||||
|
image: webapp
|
||||||
|
|
||||||
|
This will result in an image tagged `webapp`, built from `./dir`.
|
||||||
|
|
||||||
> **Note**: In the [version 1 file format](#version-1), `build` is different in
|
> **Note**: In the [version 1 file format](#version-1), `build` is different in
|
||||||
> two ways:
|
> two ways:
|
||||||
>
|
>
|
||||||
@ -340,13 +348,22 @@ An entry with the ip address and hostname will be created in `/etc/hosts` inside
|
|||||||
|
|
||||||
### image
|
### image
|
||||||
|
|
||||||
Tag or partial image ID. Can be local or remote - Compose will attempt to
|
Specify the image to start the container from. Can either be a repository/tag or
|
||||||
pull if it doesn't exist locally.
|
a partial image ID.
|
||||||
|
|
||||||
image: ubuntu
|
image: redis
|
||||||
image: orchardup/postgresql
|
image: ubuntu:14.04
|
||||||
|
image: tutum/influxdb
|
||||||
|
image: example-registry.com:4000/postgresql
|
||||||
image: a4bc65fd
|
image: a4bc65fd
|
||||||
|
|
||||||
|
If the image does not exist, Compose attempts to pull it, unless you have also
|
||||||
|
specified [build](#build), in which case it builds it using the specified
|
||||||
|
options and tags it with the specified tag.
|
||||||
|
|
||||||
|
> **Note**: In the [version 1 file format](#version-1), using `build` together
|
||||||
|
> with `image` is not allowed. Attempting to do so results in an error.
|
||||||
|
|
||||||
### labels
|
### labels
|
||||||
|
|
||||||
Add metadata to containers using [Docker labels](https://docs.docker.com/engine/userguide/labels-custom-metadata/). You can use either an array or a dictionary.
|
Add metadata to containers using [Docker labels](https://docs.docker.com/engine/userguide/labels-custom-metadata/). You can use either an array or a dictionary.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user