I'm in a planning phase for a little tool for myself. I have to say that I have close to 0 experience with docker.
My setup
- 1 x Nodejs App in a Container (lets call it App)
- n x Instances/Containers of the same image (lets call it Agent)
What I want
I'm looking for a way to restart one of the Agents from within my App.
The problem
I just managed to create my first docker-compose. From here I'm stuck. I just have no idea how to cross-access the container from my Apps container (by script) or if this is even possible and then force to restart it (like docker restart #hash
does).
My current docker-compose.yml (if that helps in any way)
version: '3'
services:
app:
container_name: app
volumes:
- .:/usr/src/app
restart: always
build: .
ports:
- '8080:3000'
links:
- agent
# no control over this as this is an existing image from docker hub
agent:
restart: always
image: image/from/dockerhub
ports:
- '1234'
... which I would run as docker-compose up --scale agent=n
.
I'm not necessarily looking for a complete solution. If someone could guide me into the right direction I would really appreciate it.
Thanks