You're going about this backwards
docker-compose.yml -> specify all services that will be always running
docker-compose.override.yml -> gets picked up automatically, usually used for development
docker-compose.*.yml -> special cases
So, in your case:
You don't remove a container defined in docker-compose.yml, you add it by override with another file or customize it with docker-compose.prod.yml, by example:
docker-compose.yml -> this is the base
version: 2
services:
www:
image: php56
docker-compose.override.yml -> this is dev
version: 2
services:
db_for_development:
image: mariadb
docker-compose.production.yml -> this is prod
version: 2
services:
www:
environment:
- APP_ENV=production
env_file:
- /home/ubuntu/production-app
docker-compose.admin.yml -> this is for the dba
version: 2
services:
adminer:
image: adminer
restart: always
ports:
- 8080:8080
instructions:
For development, docker-compose.yml and docker-compose.override.yml will be used just by running
$ docker-compose up
Production, manually specify both files
$ docker-compose -f docker-compose.yml -f docker-compose.production.yml up --remove-orphans
If you want to bring also bring adminer up (not recommended for production, but sometimes needed anyways)
$ docker-compose -f docker-compose.yml -f docker-compose.production.yml -f docker-compose.admin.yml up
Lastly, when you're done with adminer, just run the production command again this will leave adminer running as an orphan, and you do not want that. That's why the flag --remove-orphans is for