Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose down doesn't.. "down" the containers

I have a few systems where I use docker-compose and there is no problem.

However, I have one here where 'down' doesn't do anything at all. 'up' works perfectly though. This is on MacOS.

The project is nicknamed 'stormy', and here is the script:

version: '3.3'

services:
  rabbitmq:
    container_name: stormy_rabbitmq
    image: rabbitmq:management-alpine
    restart: unless-stopped
    ports:
      - 5672:5672
      - 15672:15672
    expose:
      - 5672
    volumes:
      #- /appdata/stormy/rabbitmq/etc/:/etc/rabbitmq/
      - /appdata/stormy/rabbitmq/data/:/var/lib/rabbitmq/
      - /appdata/stormy/rabbitmq/logs/:/var/log/rabbitmq/
    networks:
      - default

  settings:
    container_name: stormy_settings
    image: registry.gitlab.com/robinhoodcrypto/stormy/settings:latest 
    restart: unless-stopped
    volumes:
      - /appdata/stormy/settings:/appdata/stormy/settings
    external_links:
      - stormy_rabbitmq:rabbitmq
    networks:
      - default

  capture:
    container_name: stormy_capture
    image: registry.gitlab.com/robinhoodcrypto/stormy/capture:latest 
    restart: unless-stopped
    volumes:
      - /appdata/stormy/capture:/appdata/stormy/capture
    external_links:
      - stormy_rabbitmq:rabbitmq
    networks:
      - default

  livestream:
    container_name: stormy_livestream
    image: registry.gitlab.com/robinhoodcrypto/stormy/livestream:latest 
    restart: unless-stopped
    volumes:
      - /appdata/stormy/capture:/appdata/stormy/livestream
    external_links:
      - stormy_rabbitmq:rabbitmq
    networks:
      - default


networks:
  default:
    external:
      name: stormy-network

the 'up' script is as follows:

[ ! "$(docker network ls | grep stormy-network)" ] && docker network create stormy-network
echo '*****' | docker login registry.gitlab.com -u 'gitlab+deploy-token-******' --password-stdin
docker-compose down
docker-compose build --pull
docker-compose -p 'stormy' up -d

and the 'down' is simply:

docker-compose down

version:

$ docker-compose -v

docker-compose version 1.24.1, build 4667896b

when I do 'down', here is the output:

$ docker-compose down

Network stormy-network is external, skipping

and I put a verbose log output at: https://pastebin.com/Qnw5J88V

Why isn't 'down' working?

like image 279
Thomas Avatar asked Mar 03 '23 22:03

Thomas


1 Answers

The docker-compose -p option sets the project name which gets included in things like container names and labels; Compose uses it to know which containers belong to which Compose services. You need to specify it on all of the commands that interact with containers (docker-compose up, down, ps, ...); if you're doing this frequently, setting the COMPOSE_PROJECT_NAME environment variable might be easier.

#!/bin/sh
export COMPOSE_PROJECT_NAME=stormy
docker-compose build --pull
docker-compose down
docker-compose up -d
like image 131
David Maze Avatar answered Mar 05 '23 17:03

David Maze