-
Notifications
You must be signed in to change notification settings - Fork 8
Get container name by service name
Maksym Zaporozhets edited this page Jan 8, 2024
·
4 revisions
Get Docker container name by service name in the docker-compose*.yaml
.
php "${DOCKERIZER_PROJECTS_ROOT_DIR}dockerizer_for_php/bin/dockerizer" composition:get-container-name mysql
This is especially useful for Bash aliases when many compositions have a php
or mysql
service, but you need to get a
container name for docker exec
or other commands.
For example, here is an alias for the composer install
command:
# Export a global variable containing the path to your projects root directory
export DOCKERIZER_PROJECTS_ROOT_DIR=${HOME}/misc/apps/
# Alias to run Dockerizer from any directory
alias DOCKERIZER='php -d xdebug.start_with_request=trigger ${DOCKERIZER_PROJECTS_ROOT_DIR}dockerizer_for_php/bin/dockerizer'
# Run `CI` inside a container of a `php` service without entering the container.
# You should be in the directory containing `docker-compose.yaml` file.
alias CI='docker exec -it $(DOCKERIZER composition:get-container-name php) composer install'
-
service-name
(first argument, required): Service name in thedocker-compose*.yaml
. -
--path
(optional): Path to docker-compose files. Default:getcwd()
.
- docker:mysql:connect
- docker:mysql:export-db
- docker:mysql:import-db
- docker:mysql:upload-to-aws
- docker:mysql:generate-metadata
- docker:mysql:reconstruct-db
- docker:mysql:test-metadata
- magento:setup
- magento:reinstall
- magento:test-module-install
- magento:test-templates
- magento:test-dockerfiles
- MacOS and Docker Desktop support
- Bash aliases
- Install Symfony with Dockerizer
- Running-apps-with-existing-Docker-compositions
- Limitations
- Building MySQL images with DB: how it works
- Configure AWS Lambda
- Gitlab pipeline to build images
- Managing AWS S3 access
- Using AWS credentials with Dockerizer
- Access management cheat-sheet
- FAQ