Menu

#6549 docker-compose exec work on "run" containers

open
nobody
2019-03-07
2019-03-05
Anonymous
No

Originally created by: andyneff

Example use case

docker-compose.yml

version: "3.2"
services:
  foo:
    image: debian:9
    command: sleep 10000
  1. docker-compose run -d foo
  2. docker-compose exec foo bash

Current Result:

ERROR: No container found for foo_1

Desired result

It would be nice if not only did docker-compose exec check for containers created by up, but also run. This is already done for commands like down and ps

Example: docker-compose ps

          Name              Command     State   Ports
-----------------------------------------------------
foo_foo_run_382b47cedaf4   sleep 10000  Up

Alternative solutions

If for some reason mixing the uped and runed containers together in exec is incompatible with use cases/maintaining backwards compatibility, then specifying a flag that either "Only execs using run containers" or combines the list of up and exec containers. Which ever you think is best if this is needed.

Current work around

I currently have to have to use a mix of bash, docker-compose ps, or docker ps commands to find the container I want to exec into

Discussion


Log in to post a comment.