Multiple Docker Node-RED containers without orphan containers

I'm trying to run multiple docker container, see compose file below...

version: "3.7"

services:
  node-red:
    image: nodered/node-red:latest
    environment:
      - TZ=Europe/Amsterdam
    ports:
      - "1880:1880"
    networks:
      - node-red-net
    volumes:
      - node-red-data:/data

volumes:
  node-red-data:

networks:
  node-red-net:

and

version: "3.7"

services:
  node-red-dev:
    image: nodered/node-red:latest
    environment:
      - TZ=Europe/Amsterdam
    ports:
      - "1881:1880"
    networks:
      - node-red-dev-net
    volumes:
      - node-red-dev-data:/data

volumes:
  node-red-dev-data:

networks:
  node-red-dev-net:

After running compose up I'm getting "Found orphan containers". Have read that correct way to fix this is specify Project Name. I don't fully understand the all of this but would the correct way be to specify the same project name for both containers or individual project names?

Well by default the project is the based on the directory name containing the compose file - so either they need to be in different directories. (or use the -p projectname flag when you start it up - yes they need to be different)

However I would normally put both servers within the same compose file so I know they would share a network and it all gets set up etc... - but maybe that isn't what you want.

Thank you, any assistance is greatly appreciated.

Can you define project name in the compose file, from a search it doesn't seem possible. If that is the case then how can you differentiate projects if you are using Docker compose.

Also is it possible to view the project name one a container has been created? "eg sudo docker project-name ls" as an example.

This might all make no sense to someone who knows what they are talking about. :rofl:

as I said the project name usually just comes from the directory the compose file is located in... and usually you put all the servers you want inside one single compose file... that is usually the point of compose... to create them all at once.

Or you can use -p on the command line when you call docker-compose...

Once created the containers look like projectname_servername_01 etc
which you should be able to see in the Names column of docker ps -a

1 Like

Or install Portainer and you will get much more management and visibility of the containers you are running

Craig

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.