Skip to content

Dash '-' vs. underscore '_' after project name in container naming #62

@csandor

Description

@csandor

Great work thanks!

When I start a container with the v1.xx version of docker-compose:

docker-compose up -d <service>

the resulting container name will be: <project_name>_<service>_1

Job runs great.

When i use the go version or a v2.xx version:

docker compose up -d <service>

the resulting container name will be: <project_name>-<service>-1

See dash vs. underscore in container name.

I think docker-crontab might have the underscore (_) burnt in somewhere and tries to find the container to run the script in using that separator (/opt/crontab/projects/*.sh):

CONTAINERS=$(docker ps --format '{{.Names}}' | grep -E "^<project_name>_<container_name>.[0-9]+")

And the job won't run as would not find a running container.

docker-compose version 1.29.2, build unknown
Docker Compose version v2.15.1
Docker version 24.0.5, build ced0996

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions