Reputation: 87
I change ports in file 'docker-compose.override.yml' and run docker (docker-compose up). Docker isn't seeing my changes (ports) in override.
Content override:
version: '2'
services:
nginx:
ports:
- 87:80
Why docker isn't changing the port?
Upvotes: 5
Views: 6017
Reputation: 799
Had the same issue and found the solution, this comes from the way docker merges files and nodes, in your case it probably appended the ports to an already existing ports node coming from your base docker-compose.yml
file.
What you can do in this case is to override the node value :
services:
nginx:
ports: !override
- 87:80
NB: not sure if it works on all docker compose versions, but you never know if it might help someone in the future ^^
Upvotes: 1
Reputation:
Well, your description of the problem is quite small and pure. Actually, there are two ways of achieving thing you probably want to achieve.
So, by the first you can have several docker-compose.yml
files.
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d
On the other hand, you can use extends
option.
Rememeber, that some options in docker-compose.yml
can be concatanated, as the following quote says.
For the multi-value options ports, expose, external_links, dns, dns_search, and tmpfs, Compose concatenates both sets of values:
References:
Upvotes: 4
Reputation: 263916
The filename 'docker-composer.override.yml' is incorrect, you need to use 'docker-compose.override.yml'.
Upvotes: 0