Is it possible to pull and start all containers defined in docker-compose.yml? I'm trying to execute docker-compose up -d my/image
, where my/image
is a repo on DockerHub, but it says "Can't find docker-compose.yml". I also tried first to pull the image using docker pull my/image
with the same result
UPD: The image https://hub.docker.com/r/gplcart/core/, source - https://github.com/gplcart/docker-core
SOLVED: It seems docker-compose does not work that way I want. I need to create a directory manually, place docker-compose.yml there, then run docker-compose up
.
https://docs.docker.com/compose/wordpress/#define-the-project
I expected that running docker-compose up -d repo/image
is enough to download and run all defined containers
Most of your images will be created on top of a base image from the Docker Hub registry. Docker Hub contains many pre-built images that you can pull and try without needing to define and configure your own. To download a particular image, or set of images (i.e., a repository), use docker pull .
If you run docker-compose pull ServiceName in the same directory as the docker-compose. yml file that defines the service, Docker will pull the associated image. For example, to call the postgres image configured as the db service in our example, you would run docker-compose pull db .
The docker compose up command aggregates the output of each container (like docker compose logs --follow does). When the command exits, all containers are stopped. Running docker compose up --detach starts the containers in the background and leaves them running.
@Mamen yes, in the case to build and run, just run the Docker Compose. The images will be pulled automatically. Note that you can't push volume content, local files, or the docker-compose.
To pull an image use docker-compose pull <service_name>
, where service_name
is one of the services listed in your docker-compose.yml
file
The docker pull my/image
fails, but should fail with a different error than you noted (you posted a compose error)
In your example, my/name
is not a valid service name because you can't use a /
in the service name. Compose would give you a different error.
It's unclear to me what my/name
represents (assuming you replaced it with something locally).
If you post your docker-compose.yml
it would help determine what the correct docker
and docker-compose
commands should be.
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