restart: no
is default mode. There is line inside your docker-compose file with restart: no
or restart: unless-stopped
. It also means that when you boot your system, it (re)starts container(s) again as long as docker daemon. Details
You need to change restart
to no
or on-failure
, example:
version: '2.1'
services:
backend:
restart: on-failure
build:
args:
USER_ID: ${USER_ID}
context: codebase/namp-backend
dockerfile: Dockerfile.dev
ports:
- "5001:5001"
- "5851:5851"
volumes:
- ./codebase/namp-backend:/codebase
environment:
Also docker-compose down
for most cases, gives you the same result - do not start containers while (docker) system startup, except: containers will be deleted after this, not stopped.
restart: always
in it. If there is, then try changing it torestart: unless-stopped
. – Packsaddlerestart: always
. I will change it and see what happens. – Exodontistrestart: unless-stopped
causes docker to time out on requests (ps
,stop
,kill
). And rebooting still starts all the containers! – Exodontistdocker-compose stop
, but for medocker-compose down
works like a charm. I tend to pair it with--rmi local
, but be careful with that. – Unfamiliar