When I run docker build
I can use -t
or --tag
parameter to deterimne CONTAINER ID
.
https://docs.docker.com/engine/reference/commandline/build/
But when I use docker-compose
then I cannot find this option.
https://docs.docker.com/compose/reference/up/
I know that docker-composer
can create many containers, so maybe there is possibility of set CONTAINER ID
in docker-compose.yml
? How to do this?
the -t option to docker build
doesn't set something called CONTAINER ID
. In fact, it has nothing to do with a container. The output of docker build
is an image, which is named based on the -t option. docker build -t myorg:myimage .
creates an image called myorg:myimage
that you can use later to build containers, or push to the docker registry so that you can later use it to build a container.
The equivalent in docker-compose is docker-compose build
, not docker-compose up
. To specify an image tag in docker-compose build, you use both the build
and the image
tags on a service in the compose file- in that case, using docker-compose build
will build the image based on the build
directive, and tag the output using the image
tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With