docker-compose exec work on "run" containers
Brought to you by:
austinsuero97
Originally created by: andyneff
docker-compose.yml
version: "3.2"
services:
foo:
image: debian:9
command: sleep 10000
docker-compose run -d foodocker-compose exec foo bashERROR: No container found for foo_1
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
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.
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