Skip to content

Get container ip by service name

Maksym Zaporozhets edited this page Jun 14, 2023 · 3 revisions

composition:get-container-ip

Description

Get Docker container IP by service name in the docker-compose*.yaml.

Usage

php "${DOCKERIZER_PROJECTS_ROOT_DIR}dockerizer_for_php/bin/dockerizer" composition:get-container-ip varnish

CAUTION!

This command is currently not used in any Bash aliases. We strongly recommend using docker exec to perform and operations from inside a container. Use the tools bundled into the container when possible to avoid any issues with the environment.

It is also worth using network aliases and access the container by its domain name instead of IP.

Though, this command may still be useful for debugging purposes or in some specific cases.

Command arguments and options

  • service-name (first argument, required): Service name in the docker-compose*.yaml.
  • --path (optional): Path to docker-compose files. Default: getcwd().
Clone this wiki locally