I am using docker-compose, with a docker-compose.yml file.
Is there a way to get in .yml, the ID of another docker (which is in the same docker-compose.yml)?
docker-compose.yml:
containerA:
command: python -u catch_sig.py
volumes:
- /workspace:/app
containerB:
command: echo -e "POST /containers/containerA/kill?signal=SIGUSR1 HTTP/1.0\r\n" | nc -U /tmp/docker.sock
You can add the Docker client to containerB and then set the DOCKER_HOST environment to the underlying host (be sure to configure its settings so it accepts TCP connections on the network). Then, you can do a
docker inspect containerA
using the container name to identify the host you are querying.This should give you the container id for containerA.