If you want to rewrite your project's docker-compose.yml
docker-compose -f docker-compose.myenv.yml
By specifying a customized YAML file for the and -f
options, the command will be executed based on the original Compose configuration file.
However, it is troublesome to specify it every time.
By adding the following to .bashrc
etc., if there is a unique configuration file directly under the directory, docker-compose.myenv.yml
will be applied when dc
is executed.
.bashrc
function dc() {
if [[ -f docker-compose.myenv.yml ]]; then
echo 'Using docker-compose.myenv.yml'
docker-compose -f docker-compose.myenv.yml $@
else
docker-compose $@
fi;
}
alias dc=dc
bash:.docker-compose.myenv.When you have yml
$ dc
Using docker-compose.myenv.yml
Define and run multi-container applications with Docker.
...
Recommended Posts