Questions tagged [docker-compose]

Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.

Docker Compose is an officially supported tool to build multi-container applications. An application author or deployer creates a YAML file, generally named docker-compose.yml, that lists the containers or services that make up the application, along with other Docker-specific resources such as named volumes or containers. Docker Compose supports some features of , though it also works well for single-host Docker installations.

This tag is appropriate for questions about setting up the docker-compose.yml file and other questions about deployment or communication between containers managed by Docker Compose. It may be appropriate to tag your questions as as well. Please include a good extract of the docker-compose.yml file as a code block in your question, enough to reproduce the issue you are asking about.

Remember that questions must be programming-related. Questions on how to install Compose, how to use Compose to manage existing prebuilt images, or how to run someone else's Compose file are not programming-related and are not on topic for Stack Overflow.

Key links:

30464 questions
1068
votes
34 answers

How to fix docker: Got permission denied issue

I installed Docker in my machine where I have Ubuntu OS. When I run: sudo docker run hello-world All is ok, but I want to hide the sudo command to make the command shorter. If I write the command without sudo docker run hello-world That displays…
Carlos Andres
  • 12,740
  • 7
  • 18
  • 34
934
votes
27 answers

How can I delete all local Docker images?

I recently started using Docker and never realized that I should use docker-compose down instead of ctrl-c or docker-compose stop to get rid of my experiments. I now have a large number of unneeded docker images locally. Is there a flag I can run…
Kimmo Hintikka
  • 13,472
  • 7
  • 34
  • 63
928
votes
21 answers

Docker Compose - How to execute multiple commands?

I want to do something like this where I can run multiple commands in the following code: db: image: postgres web: build: . command: python manage.py migrate command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: …
RustyShackleford
  • 25,262
  • 6
  • 22
  • 38
924
votes
5 answers

What is the difference between ports and expose in docker-compose?

What is the difference between ports and expose options in docker-compose.yml?
Bibek Shrestha
  • 32,848
  • 7
  • 31
  • 34
623
votes
12 answers

What's the difference between Docker Compose vs. Dockerfile

I have been reading up and learning about Docker, and am trying to correctly choose the Django setup to use. So far there is either: Docker Compose or Dockerfile I understand that Dockerfiles are used in Docker Compose, but I am not sure if it is…
618
votes
31 answers

How to use local docker images with Minikube?

I have several docker images that I want to use with minikube. I don't want to first have to upload and then download the same image instead of just using the local image directly. How do I do this? Stuff I tried: 1. I tried running these commands…
Kapil Gupta
  • 7,091
  • 5
  • 16
  • 25
608
votes
20 answers

Docker Compose wait for container X before starting Y

I am using rabbitmq and a simple python sample from here together with docker-compose. My problem is that I need to wait for rabbitmq to be fully started. From what I searched so far, I don't know how to wait with container x (in my case worker)…
svenhornberg
  • 14,376
  • 9
  • 40
  • 56
600
votes
20 answers

Communication between multiple docker-compose projects

I have two separate docker-compose.yml files in two different folders: ~/front/docker-compose.yml ~/api/docker-compose.yml How can I make sure that a container in front can send requests to a container in api? I know that --default-gateway option…
Jivan
  • 21,522
  • 15
  • 80
  • 131
578
votes
13 answers

Interactive shell using Docker Compose

Is there any way to start an interactive shell in a container using Docker Compose only? I've tried something like this, in my docker-compose.yml: myapp: image: alpine:latest entrypoint: /bin/sh When I start this container using docker-compose…
drubb
  • 14,533
  • 7
  • 15
  • 11
577
votes
13 answers

How to rebuild docker container in docker-compose.yml?

There are scope of services which are defined in docker-compose.yml. These services have been started. I need to rebuild only one of these and start it without up other services. I run the following commands: docker-compose up -d # run all…
yuklia
  • 6,733
  • 5
  • 20
  • 26
575
votes
11 answers

How to restart a single container with docker-compose

I have a docker-compose.yml file that contains 4 containers: redis, postgres, api and worker. During the development of the worker container, I often need to restart it in order to apply changes. Is there any good way to restart a single container…
Bryan Chen
  • 45,816
  • 18
  • 112
  • 143
530
votes
21 answers

How to mount a single file in a volume

I am trying to dockerize a PHP application. In the dockerfile, I download the archive, extract it, etc. Everything works fine. However, if a new version gets released and I update the dockerfile, I have to reinstall the application, because the…
Jakub Juszczak
  • 7,126
  • 3
  • 21
  • 38
509
votes
24 answers

Docker: How to clear the logs properly for a Docker container?

I use docker logs [container-name] to see the logs of a specific container. Is there an elegant way to clear these logs?
Youssouf Maiga
  • 6,701
  • 7
  • 26
  • 42
448
votes
5 answers

What's the difference between Docker Compose and Kubernetes?

While diving into Docker, Google Cloud and Kubernetes, and without clearly understanding all three of them yet, it seems to me these products are overlapping, yet they're not compatible. For example, a docker-compose.yml file needs to be re-written…
George Katsanos
  • 13,524
  • 16
  • 62
  • 98
438
votes
4 answers

Difference between links and depends_on in docker_compose.yml

According to the Docker Compose's compose-file documentation: depends_on - Express dependency between services. links - Link to containers in another service and also express dependency between services in the same way as depends_on. I don't…
itsjef
  • 4,659
  • 3
  • 13
  • 12
1
2 3
99 100