Docker-compose stop doesn't work after docker-compose -p <name> up
I am using docker-compose version 2. I am running containers with docker-compose -p some_name up -d
and trying to kill them with docker-compose stop
. The teams exit with code 0
, but the containers are still up and running.
Is this the expected behavior for the version? If so, any idea how I can get around this?
My file docker-compose.yml
looks like this
version: '2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.3.0
ports:
- "9200:9200"
environment:
ES_JAVA_OPTS: "-Xmx512m -Xms512m"
xpack.security.enabled: "false"
xpack.monitoring.enabled: "false"
xpack.graph.enabled: "false"
xpack.watcher.enabled: "false"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 262144
hard: 262144
kafka-server:
image: spotify/kafka
environment:
- TOPICS=my-topic
ports:
- "9092:9092"
test:
build: .
depends_on:
- elasticsearch
- kafka-server
Update
I found that the problem was caused by using a parameter -p
and giving an explicit prefix to the container. Still looking for the best way to solve this problem.
source to share
Try to start running containers by submitting SIGKILL
with docker-compose -p some_name kill
.
I just read and experimented with something to compose CLI envs on upload-p
.
You must pass -p some_name
in kill
containers or compose
will accept the directory name if you don't.
Please let me know if this helps.
source to share