Access a compose container in interactive mode
see: solution on docker forum
Having started docker-compose using a compose file similar to:
version: "2"
services:
selenium:
restart: always
image: stesho/selenium-remote
ports:
- "4444:4444"
centaurtestservers:
restart: "no"
image: stesho/centaur-testservers
ports:
- "4004:4004"
- "4005:4005"
- "4006:4006"
- "4007:4007"
- "4008:4008"
volumes:
- B:\docker-mount\centaur-build:/tmp/centaur-build
command: bash -c "echo 'hello world'"
centaurtests:
depends_on:
- "selenium"
- "centaurtestservers"
restart: "no"
image: stesho/centaur-tests
I can run docker ps to list the container now running:
P:\>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5b32cca41c49 stesho/selenium-remote "echo 'hello world'" 2 minutes ago Restarting (0) 38 seconds ago centaurtests_selenium_run_1
c046fd91bc9f stesho/centaur-testservers "/bin/sh -c '/bin/..." 4 weeks ago Up 4 weeks 3004-3008/tcp, 0.0.0.0:4004-4008->4004-4008/tcp centaurtests_centaurtestservers_1
71fccaf3fabf stesho/selenium-remote "sh /opt/selenium/..." 4 weeks ago Up 4 weeks 0.0.0.0:4444->4444/tcp centaurtests_selenium_1
3b61025ad614 0700d505656c "/bin/sh -c 'sourc..." 4 weeks ago Up 4 weeks silly_shirley
5244fdf06b74 stesho/centaur "/bin/sh -c 'sourc..." 4 weeks ago Up 4 weeks 0.0.0.0:3004-3008->3004-3008/tcp objective_bassi
92f4b101ad6a stesho/eprints3 "/bin/bash" 7 weeks ago Up 7 weeks 0.0.0.0:8098->8098/tcp eprints_pubs
After which I can login to my chosen container in an interactive shell for example:
P:\>
docker exec -it objective_bassi bash