Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "docker-compose up" for images from Docker Hub

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

like image 868
ymakux Avatar asked Oct 28 '17 12:10

ymakux


People also ask

How do I get images from Docker Hub?

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 .

Does Docker compose up pull images?

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 .

What is Docker compose up option?

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.

Can I push Docker Compose to Docker Hub?

@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.


1 Answers

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.

like image 75
Jay Dorsey Avatar answered Sep 29 '22 13:09

Jay Dorsey