You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docker-compose up
docker-compose run myservice
PR #1930 adds a --name param to docker-compose allowing for one off executions with a custom name
Since a container with a fixed name is already running, the behavior of docker-compose run should be no different than that of docker-compose scale, which is basically the same thing as running docker run --name $some_name_that_already_exists.
Now, when running docker-compose up, the container_name directive is respected; when running docker-compose run myservice, the container_name directive is ignored and the default auto-generated container name is used.
You're using docker compose v1 which is End of Life for years. Urgently adopt Docker Compose v2 !
docker-compose run is by design used to run one-off command, expected to complete short time. Typically, running some data migration or maintenance tasks using same image as the main service. Such a container name MUST NOT collide with service name, which in many cases is running concurrently. So the generated name with a random suffix.
Can you please clarify the use-case you have to require a fixed container name ?
Description
See #1753 reported by @dunk and @aanand 's PR #1755 for more details.
In the #1753 issue reported, @dunk executed:
docker-compose up
docker-compose run myservice
PR #1930 adds a --name param to docker-compose allowing for one off executions with a custom name
Since a container with a fixed name is already running, the behavior of docker-compose run should be no different than that of docker-compose scale, which is basically the same thing as running docker run --name $some_name_that_already_exists.
Now, when running docker-compose up, the container_name directive is respected; when running docker-compose run myservice, the container_name directive is ignored and the default auto-generated container name is used.
Steps To Reproduce
No response
Compose Version
The text was updated successfully, but these errors were encountered: