docker-compose.yml
version: "3.2"
services:
foo:
image: debian:9
command: sleep 10000
docker-compose run -d foo
docker-compose exec foo bash
ERROR: 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 up
ed and run
ed 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
This would be a good one to have. Will be giving this a try perhaps this weekend.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
not stale.
This issue has been automatically marked as not stale anymore due to the recent activity.
@collin5 could you fix the failed test in your PR #6647 ?
Sure thing. Will do by this weekend.
thanks 馃檪
How would you identify the container to exec into if you had ran docker-compose run
twice ?
"Just always use the last one" would be a good starting point
I personally do this in a script (We'll call this Idea 1):
Of course, this might not be how we want to possibly strategies:
--index
or something. Of course that index would be blindly picking from the list from idea 1grep
and other commands.Hey @glours, sorry for the delay on this. Been caught up with some stuff at work lately. I've updated PR #6647 and all tests should now be passing.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it had not recent activity during the stale period.
BAD BOT!
following
we have the same issue, could we add some additional flag like --no-index in a future?
Most helpful comment
This would be a good one to have. Will be giving this a try perhaps this weekend.