31
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 ...
- 426
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|...
- 11.2k
20
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.
- 316
16
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:...
- 521
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"}'
- 241
14
votes
Healthcheck: CMD vs CMD-SHELL
Docker can either run the command using the equivalent of the OS exec syscall directly in the kernel, or it can run a shell (typically /bin/sh) to call your command. A shell provides functionality you ...
- 2,950
12
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/
- 1,251
12
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 ...
- 221
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....
- 226
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.
- 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:...
- 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
...
- 215
10
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 ...
- 12.9k
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,...
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 ...
- 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 ...
- 2,667
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 ...
- 2,950
8
votes
How can I force Docker Compose to rebuild containers when dockerfile changes?
Use this command:
docker-compose up --build
- 81
7
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'
- 171
7
votes
Accepted
Error with docker-compose - image not supported?
“Image” needs to be at the same level as “build”.
- 126
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.
- 6,762
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
$ ...
- 601
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 ...
- 748
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 ...
- 214
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 ...
- 657
6
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 ...
- 358
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 ...
- 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, ...
- 176
6
votes
Accepted
How to serve a custom index.html using the stock nginx docker image?
The "official" nginx image has a specific path where it looks for files. You can either copy a file into the image by creating a new image from it or mount your files into this path as a ...
- 8,847
5
votes
Accepted
Docker swarm stop spin up containers at 250
I just figure it out. The problem is not with the service or the swarm, it's with the network.
When I use driver: overlay the default subnet is 10.0.0.0/24 which result in 254 address. So I change ...
- 201
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
docker-compose × 241docker × 202
dockerfile × 28
containers × 17
nginx × 13
docker-swarm × 13
jenkins × 12
networking × 11
gitlab × 8
kubernetes × 6
jenkins-pipeline × 6
node.js × 6
volume × 6
continuous-deployment × 5
security × 5
continuous-integration × 4
deployment × 4
linux × 4
windows × 4
cicd × 4
databases × 4
mysql × 4
environment-variables × 4
macos × 4
amazon-web-services × 3