I'm trying to login into container using following command.
docker exec -t -i $(docker container ps -f "name=mycontainer" -q) sh
It works well in Ubuntu and isn't working in Windows 10.
On my windows machine, it only works when I supply the /bin/bash to the command.
Here is the working command:
docker exec -it mongodb /bin/bash
You have to remove the " to work.
docker exec -ti $(docker container ps -f name=mycontainername -q) sh
But why would you this anyway?
You can run:
docker exec -ti mycontainername sh
$(...)function, so you need to get your container name in other ways. Why not simply writemycontainer?