It's not possible to have an empty project name as it's used internally by docker as part of the key for container.
It's discussed in more detail here: Proposal: support for empty project names.
Answer from silleknarf on Stack Overflow
Raspberry Pi 4
OS: Dietpi
Downloaded docker-config.yml
Downloaded photoprism:
docker pull --platform=arm64 photoprism/photoprism:latest
When I run
docker compose up -d
I get
project name must not be empty
Re-installed docker, photoprism... Still the same results Tried googling but nothing comes up
Any thoughts? Thanks!
How run docker-compose without project-name? - Stack Overflow
Project name must not be empty
[BUG] using an empty compose file causes project name to be unset
project name must not be empty
It's not possible to have an empty project name as it's used internally by docker as part of the key for container.
It's discussed in more detail here: Proposal: support for empty project names.
For what it's worth, if you want to remove the project name because it appears in your terminal, you can use --no-log-prefix, as explained in this answer.
This can be done in with a parameter of the docker-compose call:
$> docker-compose -p THISISMYPROJECT_AND_NWK_NAME up -d
Unfortunately there is no way to persist it at the moment. (see: https://github.com/docker/compose/issues/745)
That's why I personally prefer adding a bash alias for my projects in ~/.bash_aliases (Debian based Linux) for example:
# project PROJECT shortcuts
alias dc_PROJECT_up='docker-compose -p PROJECT up -d'
alias dc_PROJECT_down='docker-compose -p PROJECT down'
# general docker compose shortcuts
alias dc='docker-compose '
alias dc_up='docker-compose up -d'
alias dc_down='docker-compose down'
So I can call dc_PROJECT_up to start my project with a project name PROJECT. The network name is PROJECT_default then.
Additionally you can setup additional networks with custom names in the docker-composer.yml like this (v. 2.1):
version: '2.1'
...
networks:
mynwk:
driver: bridge
name: mynwk
...
You can check this with the following command:
$> docker network ls
You should get a list of networks including yours and the default one.
you can create an .env file with key=value options such as
COMPOSE_PROJECT_NAME={project name}
you should note that this will only work when the .env file is in the current path