Skip to content

docker run --rm incompatible with restart: always #1218

@wernight

Description

@wernight

Having a docker-compose.yml with restart: always is good for services started by docker up. However when executing commands during a build or during development via docker run --rm ... it'll also restart that container and this command will loop forever.

  • Could allow specifying --restart never for docker run but that's edge.
  • Should ignore restart: during docker-compose run ... commands, only use it for docker-compose start or docker-compose up
  • Could restart linked containers even if they don't have restart: always. This would also fix the issue as one could do:
service:
  links:
    - web
  restart: always
web:
  image: nginx
  links: php
php:
  image: php

Then a docker-compose run --rm php ... would not restart this command, but a docker-compose up service would start and restart all linked services.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions