38 votes
Accepted

docker-compose healthcheck for rabbitMQ

You could use the command rabbitmq-diagnostics -q ping in case you just need a basic check. healthcheck: test: rabbitmq-diagnostics -q ping interval: 30s timeout: 30s retries: 3 More ...
pmodernell's user avatar
30 votes
Accepted

Why is one not allowed to use a Boolean in a docker-compose.yml?

This come from a design choice of YAML language about booleans Every unquoted value matching this "regex": y|Y|yes|Yes|YES|n|N|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|...
Tensibai's user avatar
  • 11.3k
24 votes
Accepted

How can I force Docker Compose to rebuild containers when dockerfile changes?

Why not docker-compose build ? https://docs.docker.com/compose/reference/build/ You can also do docker-compose up --build to force a rebuild.
janDro's user avatar
  • 356
20 votes

Healthcheck: CMD vs CMD-SHELL

Docker can either run the command using CMD which is the equivalent of the OS exec syscall directly in the kernel, or it can run using CMD-SHELL which runs a shell to call your command (typically /bin/...
BMitch's user avatar
  • 3,230
17 votes

docker-compose invalid type, it should be a string

The Docker Compose file reference states, that environment variables are defined as VARIABLE=value array elements. For your case, the docker-compose.yml file would need to be changed to this: version:...
Hexaholic's user avatar
  • 571
14 votes

docker-compose invalid type, it should be a string

You need to remove dash in front of variable. Use syntax like that: environment: NODE_CONFIG: '{"DATABASE_URL":"http://db:5984"}'
Jumshud's user avatar
  • 241
13 votes

docker-compose.yml - make network name configurable via environment variable

It is possible via network name: networks: mynetwork: name: ${STAGE_NAME} where mynetwork - name "inside" stack ${STAGE_NAME} -name for other stacks/services/containers See comment from ...
burtsevyg's user avatar
  • 231
11 votes
Accepted

Is running docker-compose not supported in BitBucket?

Here is my solution: (bitbucket-pipelines.yml) pipelines: default: - step: script: - export DOCKER_COMPOSE_VERSION=1.18.0 - export DOCKER_COMPOSE_URL=https://github....
Maksim Kostromin's user avatar
11 votes

Why is one not allowed to use a Boolean in a docker-compose.yml?

That's YAML. It interprets true as a boolean. Envars must be strings, hence the requirement to make the type explicit via quotes. Test this out with https://www.json2yaml.com/
Assaf Lavie's user avatar
  • 1,241
11 votes
Accepted

Why are unnamed volumes created when `docker-compose up` is run and do these double after issuing `docker-compose down && docker-compose up`?

Research indicated that the anonymous volumes were created by influxdb and grafana/grafana. Anonymous volumes are not given an explicit name when they are first mounted into a container, so ...
030's user avatar
  • 13.1k
11 votes

How can I force Docker Compose to rebuild containers when dockerfile changes?

I've found sometimes I need docker-compose build --no-cache if I have a bad deploy.
chovy's user avatar
  • 211
11 votes
Accepted

What is the purpose of running PHP-FPM in its own container instead in the same container as apache2/nginx?

Im heavily investigating this, and like many people, im discovering that in 2020 there doesn't seem to be so much logic in separating tightly coupled webserver + PHP + app process/code from each other:...
unity100's user avatar
  • 226
10 votes
Accepted

Is it possible to build docker images using docker-compose concurrently?

Yes, it's possible. You can use --parallel option since docker-composer 1.23.2 version. Version 1.23.2 also correct 1.23.0 bug: Reverted a 1.23.0 change that appended random strings to container ...
Alejandro Galera's user avatar
10 votes
Accepted

How to deal with docker compose's naming convention of named volumes?

Docker Prepends the current folder name with all the components name created using docker compose file. Eg : If the current folder name containing the docker-compose.yml file is test, all the volumes,...
Shubhanshu Rastogi's user avatar
9 votes
Accepted

Why should you do port mapping for docker containers?

TL;DR There are a number of use cases for port mapping, but for DevOps at scale the primary reason is generally to enable mapping well-known service ports to available ports on the host. This matters ...
CodeGnome's user avatar
  • 242
9 votes
Accepted

Docker compose volume syntax valid for Windows and Linux

Yes. Just use ./ for you current directory that the Docker-compose file is in. Your "working directory" for the compose file is just "./". If you are trying to set a directory ...
Wesley Rolnick's user avatar
8 votes

docker-compose invalid type, it should be a string

The args elements themselves need to be a string args: - 'MAVEN_USER=$MAVEN_USER' - 'MAVEN_PASSWORD=$MAVEN_PASSWORD'
Richard Collette's user avatar
8 votes

Internal network between container Docker Compose with outgoing connection

Internal Docker networks mean there is no gateway configured to reach the outside internet, you can only reach other containers from that network. In your scenario, none of your networks should have ...
BMitch's user avatar
  • 3,230
8 votes

How can I force Docker Compose to rebuild containers when dockerfile changes?

Use this command: docker-compose up --build
Parmatma's user avatar
7 votes
Accepted

Error with docker-compose - image not supported?

“Image” needs to be at the same level as “build”.
Corey Quinn's user avatar
7 votes
Accepted

When would I use docker-compose's "--service-ports" flag?

According to the Docker documentation: docker-compose run runs a one-time command against a service. [...] Commands you use with run start in new containers with configuration defined by that of the ...
Wimateeka's user avatar
  • 368
7 votes
Accepted

How do I do a dry run with docker-compose?

A dry run for docker-compose seems to be an open feature request.
Ta Mu's user avatar
  • 6,802
7 votes
Accepted

Stress testing for docker container

Just a quick follow-up on pumba. Installation (for Ubuntu): $ curl -SL https://github.com/alexei-led/pumba/releases/download/0.7.2/pumba_linux_amd64 -O $ sudo mv pumba_linux_amd64 /usr/bin/pumba $ ...
Most Wanted's user avatar
7 votes
Accepted

Docker-compose containers can't connect to each other

The Dockerfile specifies how a container image is built. The Dockerfile’s RUN command is trying to ping the db container, which is not yet running during the build phase. Once the container images ...
swysocki's user avatar
  • 798
6 votes
Accepted

Understanding how Docker volumes work with compose

db_data:/var/lib/mysql simply means that the db_data volume that was previously created will be made available in the container at /var/lib/mysql. In you example it's created at the very end of the ...
Wassim Dhif's user avatar
6 votes

Is running docker-compose not supported in BitBucket?

We are less likely to see support of native docker-compose integration because pipelines API is a custom implementation of similar functionality, and also because possible security issues, but looks ...
rombob's user avatar
  • 657
6 votes
Accepted

How to "docker-compose build" a service from code located in local git repository?

What you are specifically after (building from a bare repository on a local filesystem) isn't functionality offered by Docker, and by extension, docker-compose. Docker supports building from a few ...
user2640621's user avatar
  • 1,395
6 votes

Why does chown not work in RUN command in Docker?

Your mkdir and chown commands are RUN when building the image, whereas you then mount /var/www/app from a VOLUME, so you are replacing the created and chowned folder with the contents of ./app on the ...
Ángel's user avatar
  • 161
6 votes
Accepted

Is there one website that contains all relevant DevOps news and gets updated on a daily basis?

There is a protocol for this: RSS, Rich Site Summary. Technically, there are 3 protocols RSS, RSS2 and Atom, but most readers support all of them, and many servers mix RSS and RSS2 features. First, ...
Syfer Polski's user avatar
6 votes

Healthcheck: CMD vs CMD-SHELL

As per Docker Documentation RUN has 2 forms: RUN <command> (shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows) RUN ["executable&...
Yasen's user avatar
  • 662

Only top scored, non community-wiki answers of a minimum length are eligible