Skip to content

docker-compose run command continuously restarting  #1013

@nicph

Description

@nicph
Description of problem:

An unexpected behaviour is encountered when using docker-compose run with services defining restart: always.

docker version:

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

uname -a:
Linux docker01 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Environment details :

Host running inside a VMWare VM.

How reproducible:

Use this docker-compose file :

db:
    image: mysql
    restart: always
    environment:
        MYSQL_ROOT_PASSWORD: mypass
Steps to Reproduce:
$ docker-compose up -d
Creating mysql_db_1...
$ docker-compose run --rm db sh -c 'exec mysql -h db -uroot -p"$DB_ENV_MYSQL_ROOT_PASSWORD"'
mysql> exit
Removing mysql_db_run_1...
Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f
Actual Results:

mysql_db_run_1 is still running.

Expected Results:

mysql_db_run_1 stopped and removed.

Additional info:

If I don't specify the '--rm' option, the result is the same but without the conflict message.

It looks like docker-compose run started the container with 'restart: always' option. I did not find a way to override this behavior from the docker-compose run command. Maybe docker-compose run shall ignore restart: always in docker-compose.yml (at least since the --rm flag has been specified) or provide a way to override this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions